“GUI while loop”
问题 Okay, I have a code that looks like this: public class Test { private JPanel dummy; public checker() { dummy = new JPanel(); dummy.setVisible(false); dummy.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent arg0) { dummy.setVisible(false); runCheck(); } }); runCheck(); } private void runCheck() { if (a) { //do something dummy.setVisible(true); } } } This will create a dummy JPanel and add a component adapter that will fire each time dummy is set