如何获取事件单击“确定”对话框

时间:2017-09-08 04:31:18

标签: java swing

我有showdialog

JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.");

enter image description here

单击“确定”按钮后如何获取事件?

1 个答案:

答案 0 :(得分:3)

代码将被阻止,直到您点击

    System.out.println("before click");
    JOptionPane.showMessageDialog(null, "Eggs are not supposed to be green.");
    System.out.println("after click - do your code here");