我有类Main(jFrame)和类Edit(jFrame)我想从表中双击单元格并显示编辑(jFrame)所以当我双击新单元格时,我想在显示新的编辑(jFrame)之前关闭旧的编辑(jFrame)。谢谢
jTable1.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
JTable table =(JTable) me.getSource();
Point p = me.getPoint();
int row = table.rowAtPoint(p);
if (me.getClickCount() == 2) {
Edit n = new Edit();
player.stop();
n.setVisible(false);//It's not work.
n.setVisible(true);
Object ed = jTable1.getValueAt(jTable1.getSelectedRow(), 2);
Edit.jTextArea1.setText((String) ed);
Edit.x = jTable1.getSelectedRow();
}
}
});