• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Encuesta
 

Encuesta

on

  • 322 views

 

Statistics

Views

Total Views
322
Views on SlideShare
312
Embed Views
10

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 10

http://rigobertovegaingsistemas.blogspot.com 10

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Encuesta Encuesta Document Transcript

    • /**** @author Rigoberto Vega Linares*/public class Encuesta extends javax.swing.JFrame {public Encuesta() {initComponents();}//Creacion De Los Contadores//private intContador_Menor_Casado=0,Opinion_Menor_Casado=0,Contador_Menor_Soltero=0,Opinion_Menor_Soltero=0,Contador_Medio_Casado=0;private intOpinion_Medio_Casado=0,Contador_Medio_Soltero=0,Opinion_Medio_Soltero=0,Contador_Mayor_Casado=0,Opinion_Mayor_Casado=0;private int Contador_Mayor_Soltero=0,Opinion_Mayor_Soltero=0;@SuppressWarnings("unchecked")// <editor-fold defaultstate="collapsed" desc="Generated Code">private void initComponents() {//Inicializacion De Cada Uno De Los Componentes Del Interfaz grafico.//Panel_Opinion = new javax.swing.JPanel();jLabel1 = new javax.swing.JLabel();Mensaje_Edad = new javax.swing.JLabel();Bombox_Edad = new javax.swing.JComboBox();jLabel3 = new javax.swing.JLabel();Combo_Estado = new javax.swing.JComboBox();
    • Label_Opinion = new javax.swing.JLabel();Opinion = new javax.swing.JComboBox();Agregar_Opinion = new javax.swing.JButton();Panel_Resultados = new javax.swing.JPanel();Label_Opiniones = new javax.swing.JLabel();Opiniones = new javax.swing.JLabel();Label_promedio = new javax.swing.JLabel();Promedio = new javax.swing.JLabel();Rango_Edad = new javax.swing.JLabel();Combox_Rango_Edad = new javax.swing.JComboBox();jLabel2 = new javax.swing.JLabel();Combox_Estado_Civil = new javax.swing.JComboBox();Consultar = new javax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);Panel_Opinion.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "AGREGAROPINION A ENCUESTA", javax.swing.border.TitledBorder.CENTER,javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), newjava.awt.Color(0, 153, 153))); // NOI18N//Creacion De La Pregunta Con El Tipo De Letra/jLabel1.setBackground(new java.awt.Color(0, 0, 0));jLabel1.setFont(new java.awt.Font("Arial", 1, 14));jLabel1.setText("¿CUAL ES SU OPINION SOBRE ESTE CURSO? CALIFICAR DE 1 A 10");//Creacion Del Label Que Pregunta La Edad//
    • Mensaje_Edad.setFont(new java.awt.Font("Arial", 1, 12));Mensaje_Edad.setText("Rango De Edad: ");//Creacion De Desplegable De Las EdadesBombox_Edad.setFont(new java.awt.Font("Arial", 1, 14));Bombox_Edad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 - 17", "18- 54", "Mas 55" }));Bombox_Edad.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {Bombox_EdadActionPerformed(evt);}});//Creacion Del Label Que Pregunta estado CiviljLabel3.setFont(new java.awt.Font("Arial", 1, 12));jLabel3.setText("Estado Civil: ");//Creacion De Desplegable Del Estado CivilCombo_Estado.setFont(new java.awt.Font("Arial", 1, 12));Combo_Estado.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Casado(a)", "Soltero(a)" }));//Creacion Del Label Para La CalificacionLabel_Opinion.setFont(new java.awt.Font("Arial", 1, 12));Label_Opinion.setText("Opinion: ");//Creacion Del Despegable De Las Opiniones Y Calificacion De La Pregunta
    • Opinion.setFont(new java.awt.Font("Arial", 1, 12));Opinion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3","4", "5", "6", "7", "8", "9", "10" }));//Creacion Del Boton Para Agregar La OpinionAgregar_Opinion.setFont(new java.awt.Font("Arial", 1, 14));Agregar_Opinion.setText("Agregar Opinion");Agregar_Opinion.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {Agregar_OpinionActionPerformed(evt);}});//Creacion Del Panel Prncipal Llamado El De Opinionjavax.swing.GroupLayout Panel_OpinionLayout = newjavax.swing.GroupLayout(Panel_Opinion);Panel_Opinion.setLayout(Panel_OpinionLayout);//Agregacion De Cada Uno DeLos Componentes Del Pane De OpinionPanel_OpinionLayout.setHorizontalGroup(Panel_OpinionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_OpinionLayout.createSequentialGroup().addGroup(Panel_OpinionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_OpinionLayout.createSequentialGroup().addGap(20, 20, 20)
    • .addComponent(jLabel1)).addGroup(Panel_OpinionLayout.createSequentialGroup().addContainerGap().addComponent(Mensaje_Edad, javax.swing.GroupLayout.PREFERRED_SIZE, 107,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Bombox_Edad, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Combo_Estado, javax.swing.GroupLayout.PREFERRED_SIZE, 85,javax.swing.GroupLayout.PREFERRED_SIZE).addGap(47, 47, 47).addComponent(Label_Opinion).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Opinion, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(Panel_OpinionLayout.createSequentialGroup().addGap(181, 181, 181).addComponent(Agregar_Opinion))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));Panel_OpinionLayout.setVerticalGroup(Panel_OpinionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_OpinionLayout.createSequentialGroup()
    • .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 47,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(Panel_OpinionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(Mensaje_Edad, javax.swing.GroupLayout.PREFERRED_SIZE, 27,javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(Bombox_Edad, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3).addComponent(Combo_Estado, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(Label_Opinion).addComponent(Opinion, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Agregar_Opinion).addContainerGap()));//Creacion Del Panel De ResultadosPanel_Resultados.setBorder(javax.swing.BorderFactory.createTitledBorder(null,"RESULTADOS ENCUENTA", javax.swing.border.TitledBorder.CENTER,javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), newjava.awt.Color(0, 153, 153))); // NOI18N//creacion Del Label Del Numero De OpinionesLabel_Opiniones.setFont(new java.awt.Font("Arial", 1, 14)); //Label_Opiniones.setText("Numero De Opiniones: ");
    • Opiniones.setFont(new java.awt.Font("Arial", 1, 14)); ////creacion Del Label Para el PromedioLabel_promedio.setFont(new java.awt.Font("Arial", 1, 14)); //Label_promedio.setText("Promedio Total Opiniones: ");Promedio.setFont(new java.awt.Font("Arial", 1, 14)); ////creacion Del Label Para Saber La Calificacion Del Rango De EdadRango_Edad.setFont(new java.awt.Font("Arial", 1, 12)); //Rango_Edad.setText("Rando De Edad: ");Combox_Rango_Edad.setFont(new java.awt.Font("Arial", 1, 12));Combox_Rango_Edad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0 -17", "18 - 54", "Mas 55" }));jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18NjLabel2.setText("Estado Civil: ");//creacion Del Label Para Saber La Calificacion Del Estado CivilCombox_Estado_Civil.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18NCombox_Estado_Civil.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Casado(a)", "Soltero(a)" }));//creacion Del boton Para consultar
    • Consultar.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18NConsultar.setText("Consultar");Consultar.addActionListener(new java.awt.event.ActionListener() {public void actionPerformed(java.awt.event.ActionEvent evt) {ConsultarActionPerformed(evt);}});//Agregacion De Cada Uno De Los Componentes del Label De Resultadosjavax.swing.GroupLayout Panel_ResultadosLayout = newjavax.swing.GroupLayout(Panel_Resultados);Panel_Resultados.setLayout(Panel_ResultadosLayout);Panel_ResultadosLayout.setHorizontalGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_ResultadosLayout.createSequentialGroup().addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_ResultadosLayout.createSequentialGroup().addGap(118, 118, 118).addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(Label_promedio).addComponent(Label_Opiniones)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    • .addComponent(Opiniones).addComponent(Promedio))).addGroup(Panel_ResultadosLayout.createSequentialGroup().addContainerGap().addComponent(Rango_Edad).addGap(16, 16, 16).addComponent(Combox_Rango_Edad, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18).addComponent(jLabel2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Combox_Estado_Civil, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(37, 37, 37).addComponent(Consultar))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));Panel_ResultadosLayout.setVerticalGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(Panel_ResultadosLayout.createSequentialGroup().addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(Label_Opiniones).addComponent(Opiniones)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    • .addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(Label_promedio).addComponent(Promedio)).addGap(18, 18, 18).addGroup(Panel_ResultadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(Rango_Edad).addComponent(Combox_Rango_Edad, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel2).addComponent(Combox_Estado_Civil, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(Consultar))));javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,false).addComponent(Panel_Opinion, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    • .addComponent(Panel_Resultados, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(Panel_Opinion, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(Panel_Resultados, javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));pack();}private void Agregar_OpinionActionPerformed(java.awt.event.ActionEvent evt) {//Este Swicth Agrega A Los COntadores Las Accionesswitch (Bombox_Edad.getSelectedIndex()){case 0:if (Combo_Estado.getSelectedIndex()==0){Contador_Menor_Casado++;Opinion_Menor_Casado+=Opinion.getSelectedIndex();break;
    • }else{Contador_Menor_Soltero++;Opinion_Menor_Soltero+=Opinion.getSelectedIndex();break;}case 1:if (Combo_Estado.getSelectedIndex()==0){Contador_Medio_Casado++;Opinion_Medio_Casado+=Opinion.getSelectedIndex();break;}else{Contador_Medio_Soltero++;Opinion_Medio_Soltero+=Opinion.getSelectedIndex();break;}case 2:if (Combo_Estado.getSelectedIndex()==0){Contador_Mayor_Casado++;Opinion_Mayor_Casado+=Opinion.getSelectedIndex();break;}else{Contador_Mayor_Soltero++;Opinion_Mayor_Soltero+=Opinion.getSelectedIndex();break;}}
    • }private void ConsultarActionPerformed(java.awt.event.ActionEvent evt) {int mostrar;//Aqui se muestra de acuerdo con la cunsulta seleccionada y muestra en labels el datoswitch (Combox_Rango_Edad.getSelectedIndex()){case 0:if (Combox_Estado_Civil.getSelectedIndex()==0){Opiniones.setText(Integer.toString(Contador_Menor_Casado));mostrar=Opinion_Menor_Casado/Contador_Menor_Casado;Promedio.setText(Integer.toString(mostrar));break;}else{Opiniones.setText(Integer.toString(Contador_Menor_Soltero));mostrar=Opinion_Menor_Soltero/Contador_Menor_Soltero;Promedio.setText(Integer.toString(mostrar));break;}case 1:if (Combox_Estado_Civil.getSelectedIndex()==0){Opiniones.setText(Integer.toString(Contador_Medio_Casado));mostrar=Opinion_Medio_Casado/Contador_Medio_Casado;Promedio.setText(Integer.toString(mostrar));break;}else{Opiniones.setText(Integer.toString(Contador_Medio_Soltero));
    • mostrar=Opinion_Medio_Soltero/Contador_Medio_Soltero;Promedio.setText(Integer.toString(mostrar));break;}case 2:if (Combox_Estado_Civil.getSelectedIndex()==0){Opiniones.setText(Integer.toString(Contador_Mayor_Casado));mostrar=Opinion_Mayor_Casado/Contador_Mayor_Casado;Promedio.setText(Integer.toString(mostrar));break;}else{Opiniones.setText(Integer.toString(Contador_Mayor_Soltero));mostrar=Opinion_Mayor_Soltero/Contador_Mayor_Soltero;Promedio.setText(Integer.toString(mostrar));break;}}}public static void main(String args[]) {java.awt.EventQueue.invokeLater(new Runnable() {public void run() {new Encuesta().setVisible(true);}});}// Declaracion De las Variables
    • private javax.swing.JButton Agregar_Opinion;private javax.swing.JComboBox Bombox_Edad;private javax.swing.JComboBox Combo_Estado;private javax.swing.JComboBox Combox_Estado_Civil;private javax.swing.JComboBox Combox_Rango_Edad;private javax.swing.JButton Consultar;private javax.swing.JLabel Label_Opinion;private javax.swing.JLabel Label_Opiniones;private javax.swing.JLabel Label_promedio;private javax.swing.JLabel Mensaje_Edad;private javax.swing.JComboBox Opinion;private javax.swing.JLabel Opiniones;private javax.swing.JPanel Panel_Opinion;private javax.swing.JPanel Panel_Resultados;private javax.swing.JLabel Promedio;private javax.swing.JLabel Rango_Edad;private javax.swing.JLabel jLabel1;private javax.swing.JLabel jLabel2;private javax.swing.JLabel jLabel3;}