来自大型机的java setvisible(false)

时间:2017-03-03 02:41:55

标签: java swing jframe

我有类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();
    }
}

    });

0 个答案:

没有答案