java – Como puedo imprimir items from 2 jComboBox to a TextField?

Como ven quiero que en el TextField de abajo me imprima los article combo box pero me aparece mucho texto que no quiero.

Package encuesta1;

import javax.swing.JOptionPane;

The public class encuesta_1 extends javax.swing.JFrame {


public encuesta_1 () {
initComponents ();
}

@SuppressWarnings ("unchecked")
//                           
    private void initComponents () {

Pregunta1 = new javax.swing.ButtonGroup ();
Pregunta2 = new javax.swing.ButtonGroup ();
Pregunta3 = new javax.swing.ButtonGroup ();
label1 = new java.awt.Label ();
label2 = new java.awt.Label ();
label3 = new java.awt.Label ();
jCheckBox1 = new javax.swing.JCheckBox ();
jCheckBox2 = new javax.swing.JCheckBox ();
jCheckBox3 = new javax.swing.JCheckBox ();
jCheckBox4 = new javax.swing.JCheckBox ();
label4 = new java.awt.Label ();
jCheckBox5 = new javax.swing.JCheckBox ();
jCheckBox6 = new javax.swing.JCheckBox ();
jCheckBox7 = new javax.swing.JCheckBox ();
jCheckBox8 = new javax.swing.JCheckBox ();
label5 = new java.awt.Label ();
jRadioButton1 = new javax.swing.JRadioButton ();
jRadioButton2 = new javax.swing.JRadioButton ();
jRadioButton3 = new javax.swing.JRadioButton ();
label6 = new java.awt.Label ();
label7 = new java.awt.Label ();
jComboBox1 = new javax.swing.JComboBox <> ();
jComboBox2 = new javax.swing.JComboBox <> ();
resultado = new javax.swing.JTextField ();
jButton1 = new javax.swing.JButton ();
gracias = new javax.swing.JTextField ();

setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);

label1.setFont (new java.awt.Font ("Dialog", 1, 36)); // NOI18N
label1.setPreferredSize (new java.awt.Dimension (40, 30));
label1.setText ("Encuesta referente a el area de Sistemas");

label2.setFont (new java.awt.Font ("Dialog", 3, 18)); // NOI18N
label2.setText ("Selecciona una opcion de las siguientes preguntas.");

label3.setFont (new java.awt.Font ("Dialog", 1, 14)); // NOI18N
label3.setText ("1 ° - Cual es el languaje de programacion que mas te gusta?");

Pregunta1.add (jCheckBox1);
jCheckBox1.setText ("C #");

Pregunta1.add (jCheckBox2);
jCheckBox2.setText ("C ++");

Pregunta1.add (jCheckBox3);
jCheckBox3.setText ("Java");

Pregunta1.add (jCheckBox4);
jCheckBox4.setText ("Pyton");

label4.setFont (new java.awt.Font ("Dialog", 1, 14)); // NOI18N
label4.setText ("2 ° - Por que prefieres ese lenguaje?");

Pregunta2.add (jCheckBox5);
jCheckBox5.setText ("Facilidad");

Pregunta2.add (jCheckBox6);
jCheckBox6.setText ("Esta muy completo");

Pregunta2.add (jCheckBox7);
jCheckBox7.setText ("Estoy acostumbrado");

Pregunta2.add (jCheckBox8);
jCheckBox8.setText ("No, he probado otros");

label5.setFont (new java.awt.Font ("Dialog", 1, 14)); // NOI18N
label5.setText ("3 ° - you are here to create a presentation that is in the queue" Lo cambiarias? ");

Pregunta3.add (jRadioButton1);
jRadioButton1.setText ("Si");

Pregunta3.add (jRadioButton2);
jRadioButton2.setText ("No");

Pregunta3.add (jRadioButton3);
jRadioButton3.setText ("Probablemente");

label6.setFont (new java.awt.Font ("Dialog", 0, 14)); // NOI18N
label6.setText ("Qué te parecio la encuesta?");

label7.setText ("Recomendarias esta encuesta?");

jComboBox1.setModel (new javax.swing.DefaultComboBoxModel <> (new string[] {"Exelente", "Buena", "Regular", "Mala", "Muy mala"})));
jComboBox1.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed (evt);
}
});

jComboBox2.setModel (new javax.swing.DefaultComboBoxModel <> (new string[] {"Si", "No", "Probablemente"}));

jButton1.setText ("Terminar");
jButton1.addActionListener (new java.awt.event.ActionListener () {
public void actionPerformed (java.awt.event.ActionEvent evt) {
jButton1ActionPerformed (evt);
}
});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout (getContentPane ());
getContentPane (). setLayout (layout);
layout.setHorizontalGroup (
layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup ())
.addGap (162, 162, 162)
.addComponent (jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent (jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap (168, 168, 168))
.addGroup (layout.createSequentialGroup ())
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup ())
.addContainerGap ()
.addComponent (label1, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup (layout.createSequentialGroup ())
.addGap (65, 65, 65)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup ())
.addComponent (jCheckBox1)
.addGap (80, 80, 80)
.addComponent (jCheckBox2))
.addGroup (layout.createSequentialGroup ())
.addComponent (jCheckBox5)
.addGap (42, 42, 42)
.addComponent (jCheckBox6)))
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup ())
.addGap (66, 66, 66)
.addComponent (jCheckBox3)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup (javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup ())
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
.addComponent (jCheckBox7)
.addGap (29, 29, 29)))
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addComponent (jCheckBox4)
.addComponent (jCheckBox8))
.addGap (22, 22, 22))
.addGroup (javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup ())
.addGap (23, 23, 23)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addComponent (label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup (javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup ())
.addGap (67, 67, 67)
.addComponent (jRadioButton1)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent (jRadioButton2)
.addGap (208, 208, 208)
.addComponent (jRadioButton3)))
.addGroup (layout.createSequentialGroup ())
.addGap (108, 108, 108)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addComponent (gracias, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup (layout.createSequentialGroup ())
.addComponent (label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap (111, 111, 111)
.addComponent (label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap (javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup (javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup ())
.addContainerGap (javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent (resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 633, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap (javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup (layout.createSequentialGroup ())
.addGap (313, 313, 313)
.addComponent (jButton1)
.addContainerGap (javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup (
layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup ())
.addGap (22, 22, 22)
.addComponent (label1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap (20, 20, 20)
.addComponent (label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent (label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (jCheckBox1)
.addComponent (jCheckBox2)
.addComponent (jCheckBox3)
.addComponent (jCheckBox4))
.addGap (8, 8, 8)
.addComponent (label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (jCheckBox5)
.addComponent (jCheckBox6)
.addComponent (jCheckBox7)
.addComponent (jCheckBox8))
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent (label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (jRadioButton1)
.addComponent (jRadioButton2)
.addComponent (jRadioButton3))
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
.addComponent (resultado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addComponent (label6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.PriorerRefreier
.addComponent (label7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.PriorerRefreier).
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup (layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap (53, 53, 53)
.addComponent (jButton1)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent (gracias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap (27, 27, 27))
);

Pack();
} //                         

    private void jButton1ActionPerformed (java.awt.event.ActionEvent evt) {
String mensaje1 = "";
String mensaje2 = "";
String mensaje3 = "";
// Checkbox de la pregunta 1
if (jCheckBox1.isSelected ()) {
mensaje1 = ("C #");
} if (jCheckBox2.isSelected ()) {
Mensaje1 = ("C ++");
} if (jCheckBox3.isSelected ()) {
mensaje1 = ("Java");
} if (jCheckBox4.isSelected ()) {
Mensaje1 = ("Pyton");
}

// Checkbox de la pregunta 2
if (jCheckBox5.isSelected ()) {
mensaje2 = ("ofrece una gran facilidad");
} if (jCheckBox6.isSelected ()) {
mensaje2 = ("esta muy completo");
} if (jCheckBox7.isSelected ()) {
mensaje2 = ("estas acostumbrado");
} if (jCheckBox8.isSelected ()) {
mensaje2 = ("no has probado otros");
}

// RadioButtons de la pregunta 3
if (jRadioButton1.isSelected ()) {
mensaje3 = "si";
} else if (jRadioButton2.isSelected ()) {
mensaje3 = "no";
} else if (jRadioButton3.isSelected ()) {
mensaje3 = "probablemente";
}

resultado.setText ("Para rectificar, prefieres el" + mensaje1 + "por que" + mensaje2 + "y" + mensaje3 + "cambiarias de lenguaje.");

// Metodo para obtener el item del ComboBox1
jComboBox1.getSelectedItem (). toString ();

// Metodo para obtener el item del ComboBox2
jComboBox2.getSelectedItem (). toString ();

gracias.setText ("Gracias por calificar como" + jComboBox1 + jComboBox2);
}

private void jComboBox1ActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

/ **
* @param args the command-line arguments
* /
public static void main (string arguments[]) {
/ * Set Nimbus Look and Feel * /
//
        / * If Nimbus (introduced in Java SE 6) is not available, maintain the default look and feel.
* For more information, visit http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
* /
To attempt {
for (javax.swing.UIManager.LookAndFeelInfo info: javax.swing.UIManager.getInstalledLookAndFeels ()) {
if ("Nimbus" .equals (info.getName ())) {
javax.swing.UIManager.setLookAndFeel (info.getClassName ());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger (encuesta_1.class.getName ()). log (java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger (encuesta_1.class.getName ()). log (java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger (encuesta_1.class.getName ()). log (java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger (encuesta_1.class.getName ()). log (java.util.logging.Level.SEVERE, null, ex);
}
//

        / * Create and display form * /
java.awt.EventQueue.invokeLater (new Runnable ())
public void run () {
new encuesta_1 (). setVisible (true);
}
});
}

// variable declaration - do not change
private javax.swing.ButtonGroup Pregunta1;
private javax.swing.ButtonGroup Pregunta2;
private javax.swing.ButtonGroup Pregunta3;
private javax.swing.JTextField-Gracias;
private javax.swing.JButton jButton1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JCheckBox jCheckBox3;
private javax.swing.JCheckBox jCheckBox4;
private javax.swing.JCheckBox jCheckBox5;
private javax.swing.JCheckBox jCheckBox6;
private javax.swing.JCheckBox jCheckBox7;
private javax.swing.JCheckBox jCheckBox8;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private java.awt.Label label1;
private java.awt.Label label2;
private java.awt.Label label3;
private java.awt.Label label4;
private java.awt.Label label5;
private java.awt.Label label6;
private java.awt.Label label7;
private javax.swing.JTextField resultado;
// end of the variable declaration
}