I need to know how I can make the data of jtable
of an internal frame go to another jtable
that is in jframe
in java netbeans , I'm doing a project in this language and I'm new to this.
This is part of the code:
try {
DefaultTableModel modelo = (DefaultTableModel) recipe.tblrecipe.getModel();
String[] datos = new String[5];
int fil = tblinsumos.getSelectedRow();
if (fil == -1) {
JOptionPane.showMessageDialog(null, "NO HAS SELECCIONADO NINGUN INSUMO", "ADVERTENCIA", JOptionPane.WARNING_MESSAGE);
} else {
String generico = tblinsumos.getValueAt(fil, 1).toString();
String comercial = tblinsumos.getValueAt(fil, 2).toString();
String formafarma = tblinsumos.getValueAt(fil, 3).toString();
String concentracion = tblinsumos.getValueAt(fil, 4).toString();
String dosis = JOptionPane.showInputDialog("POR FAVOR INGRESA LA CANTIDAD A DISPENSAR");
if (dosis.equals("") || dosis.equals("0")) {
JOptionPane.showMessageDialog(this, "LA CANTIDAD DEBE SER \n SUPERIOR A 0", "ADVERTENCIA", JOptionPane.INFORMATION_MESSAGE);
} else {
modelo = (DefaultTableModel) recipe.tblrecipe.getModel();
String filaelemento[] = {
generico,
comercial,
formafarma,
concentracion,
dosis
};
modelo.addRow(filaelemento);
}
}
} catch (Exception e) {}