public class Job_GUI extends javax.swing.JFrame {
private JobDTO jdto;
public Job_GUI() {
initComponents();
}
private void menuEditJobActionPerformed(java.awt.event.ActionEvent evt) {
editJob.setVisible(true);
//here I want to obtain the updated dto.
}
}
public class JobDTO extends BaseDTO {
//setters and getters
}
class ListDataUI {
private void initListeners() {
summaryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
summaryTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
final int selectedRowIndex = summaryTable.getSelectedRow();
if (selectedRowIndex != -1) {
BaseDTO dto = data.get(summaryTable.convertRowIndexToModel(selectedRowIndex));
} else {
}
}
}
});
}
}
我不知道如何获取BaseDTO
对象dto
到menuEditJobActionPerformed
方法,所以我可以显示对象的所有值。我如何从valueChanged
事件发生时传递它?I'm simply using a table, when a row is selected, the dto state changes, need to pass this new state to the class Job_GUI actionperformed method