From: Todd O'B. <tod...@ma...> - 2003-03-15 15:02:52
|
I'm running jEdit in a lab environment using K12LTSP and everything's going great. My students have been making a graphical version of Tic Tac Toe using some crutch classes I provided to hide some of Java's graphic intricacies, and I think my shoddy code is causing a major load on the server. Rather than have them write a MouseListener themselves, I just provided one that saves the last MouseEvent into an instance variable. When they want to read a MouseEvent, they call a getMouseClick() method on their main window which looks like this: /** * This method will wait until the user clicks somewhere in this * <code>Picture</code> and then return the MouseEvent they caused */ public MouseEvent getMouseClick() { this.lastMouseEvent = null; while (lastMouseEvent == null) { //wait here } return lastMouseEvent; } That tight while loop is really eating up my server time. Could anybody suggest a better way of doing this? Thanks in advance, and sorry for the off-topic post, Todd |