Problem
I'm currently halfway through creating the Game of Life simulator in Java (at Eclipse) using the Swing GUI as part of a college project. This happens surprisingly, except for one small flaw -
It works on my netbook, but not on any other PC that I have tried. This is under Ubuntu.
Some structural diagrams - I have a model, view and controller. I have not defined a model yet, but I made a view (part of the GUI) and started the controller. The controller is started by the Main method, and the controller then creates the View class in a separate thread and enters a while loop.
View implements the queue of "orders" that it received from user input, mouse clicks and what not. The controller selects these orders from the queue at the iteration of the while loop and executes them as necessary.
However, although the code works fine on my netbook (latest version, Java 1.6.0_20), it doesn't work on my PC (latest version again, Java 1.6.0_20) or college computers (karmic, some previous versions of Java). It just stops when it gets into the getNextCommand method.
No errors, he just refuses to print / execute
The source files are here - http://www.mediafire.com/?dfwtdkj1tdxd5xl The
files of interest are Controller and View.
Example
In the view, I have this function:
public Command getNextCommand() {
System.out.println(commands.getFirst().id);
return commands.pop();
}
, getNextCommand(), , .
while :
while(!stop) {
if (gui.hasCommand()){
order = gui.getNextCommand();
//System.out.println("Something");
//if(order.id.equals("stop")) { stop = true; }
}
}
. getNextCommand, .
, . !
? , ?:
, .class, Eclipse, ( , ). , javac, .
!
,
.
, ( id (String), x, y (int) value (int)), getNextCommand, Integer. - .