java – jcomboBox mysql netbeans

good day community, i have a problem with a query i make in MySql-java, i have two tables, one is a record (like a history), the second table fetches data from the first table and leaves me the rest Assign dates to complete said table. So far there is no confusion, the problem occurs when I query the data and that it is assigned to the fields to be changed. I only load the data into the field in which the query is executed, the rest I only get data zero, otherwise I cannot load any of the data into a JComboBox.
I leave the query code as well as the button for the query.

/*consulta la db*/
public Object()() consultaIng(int tdc) {
          Object()() datos = new String(1)(6);
    try {
        PreparedStatement pstm = (PreparedStatement)     con.getConnection().prepareStatement("SELECT "
                + " persona.td, persona.nu, persona.ape1,    persona.ape2, persona.noms, ingPersona.ubica,"
                + " FROM persona, ingPersona"
                + " WHERE persona.td =" + tdc
                + " ORDER BY td ");
        try (ResultSet res = pstm.executeQuery()) {
            int a = 1;

            while (res.next()) {
                int td = res.getInt("td");
                int nu = res.getInt("nu");
                String ape1 = res.getString("ape1");
                String ape2 = res.getString("ape2");
                String nombre = res.getString("noms");
                String ubica = res.getString(Integer.getInteger("ubica"));
                datos(a)(0) = String.valueOf(td);
                datos(a)(1) = String.valueOf(nu);
                datos(a)(2) = ape1;
                datos(a)(3) = ape2;
                datos(a)(4) = nombre;
                datos(a)(5) = ubica;
                a++;
            }
        }
    } catch (SQLException e) {
        System.out.println(e);
    }
    return datos;
}

This query throws me this error:
ava.sql.SQLSyntaxErrorException: Your SQL syntax is incorrect. In the manual that corresponds to your MySQL server version, line 1 contains the correct syntax for FROM persona, ingPersona WHERE persona.td = 138001284 ORDER BY td

This is the key code

 private void btnConsulActionPerformed(java.awt.event.ActionEvent evt) {                                          
    if (txtTd.getText().equals("")) {
        JOptionPane.showMessageDialog(new JDialog(), "Falta digitar el T.D. del P.L.");
    } else {
        int tdc = Integer.parseInt(txtTd.getText());
        dtPer1 = fi.consultaIng(tdc);
        txtnUi.setText(String.valueOf(dtPer1(0)(1)));
        txtPap.setText(String.valueOf(dtPer1(0)(2)));
        txtSap.setText(String.valueOf(dtPer1(0)(3)));
        txtNom.setText(String.valueOf(dtPer1(0)(4)));
        cbxUbi.setSelectedItem(String.valueOf(dtPer1(0)(5)));
        lblBusca.setEnabled(false);
}                                         

}

that throws zero values ​​into the fields for me.

java – To pass data from a JTable from one frame to a JCombobox from another frame (unexpected result)

Good morning friends.

It turns out that I want to click on a table of a frame, and that data is captured to send to a combo box of another frame.

The steps I take are shown in the following picture. I've put it in a picture so they can see what's normal and should work, but simply the result is not what was expected.

I've tried various ways to place the public components, instantiate the frames, handle the combox from the other frame, and try to send data from my second frame to the first, so many things, that the ideas out.
and I say this because I think it should work better, but the result is absurd.

Here is the readable code:
Frame where the combo box is located:

                private void search_catebtnActionPerformed (java.awt.event.ActionEvent evt) {
search_category bcate = new search category ();
bcate.setVisible (true);
}


public void getDato (String nombrecat) {
category_prodventacombo.setSelectedItem (catname);
}

Frame where the table is:

                private void category_tableMouseClicked (java.awt.event.MouseEvent evt) {
int rowselected = category_table.getSelectedRow ();
if (lines == - 1) {
JOptionPane.showMessageDialog (null, "No line was selected");
} else {
String name = String.valueOf (model_categories.getValueAt (category_table.getSelectedRow (), 1));
System.out.print (name);
prodventa.getData (name);
}
} 

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
}