单击按钮无法关闭一帧

时间:2014-04-10 10:56:24

标签: java joptionpane

单击按钮会使当前表单不可见但没有任何反应。任何人都可以帮助我

if(e.getSource = b5) {
    int r = JOptionPane.showConfirmDialog(null, "Exit", "Exit?", JOptionPane.YES_NO_OPTION);

    if(r == JOptionPane.YES_OPTION) {
        encoder cc= new encoder() // this is the frame i am currently working in
        cc.setVisible(false);     // this should make the form invisible but that is not   happening
        cc.dispose();
    }
}

请帮助

2 个答案:

答案 0 :(得分:0)

if语句中的e.getSource = b5必须为e.getSource == b5。你正在分配,而不是评估。

答案 1 :(得分:0)

您正在创建新的编码器并尝试使其不可见并立即处置。 这永远不可见,所以让它看不见对我来说毫无意义。

相关问题