Hi, I'm trying to pass data from a JTable to a JDialog (attached code).
I've also tried this code with a JFrame and all the data passed to the latter (I've already put public and static to both JTextField ), so is there anything wrong with it? the code I made or is it that when using a JDialog you need to add more things?
I appreciate your answers.
private void editar() {
ProductoEditar2 edita = new ProductoEditar2(this,true);
edita.setVisible(true);
int seleccionar = tblProductos.getSelectedRow();
if (seleccionar >= 0) {
Object[] filaselect = {
tblProductos.getValueAt(seleccionar, 0),
tblProductos.getValueAt(seleccionar, 1),
tblProductos.getValueAt(seleccionar, 2)};
ProductoEditar2.tnombre.setText(String.valueOf(filaselect[0]));
ProductoEditar2.tcantidad.setText(String.valueOf(filaselect[1]));
ProductoEditar2.tprecio.setText(String.valueOf(filaselect[2]));
}