Java mouse listener isn't working
问题 I'm studying Java and learning how to use mouse listener. However here is a very simple code which doesn't work. import acm.program.*; import java.awt.event.*; public class Test extends GraphicsProgram{ public void run() { isMouseClicked= false; addMouseListeners(); while (true) { if (isMouseClicked) { println ("OK"); break; } } } public void mouseClicked(MouseEvent e) { isMouseClicked= true; } private boolean isMouseClicked; } The idea is very simple. "isMouseClicked" is false at the