/** * Action that happens when the cancel button is pressed. This closes the dialog without saving * any of that data. * * @param evt */ private void cancelButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cancelButtonActionPerformed this.dispose(); MainWindow.getInstance().addObject.setEnabled(true); MainWindow.getInstance().editObject.setEnabled(false); MainWindow.getInstance().runSimulation.setEnabled(false); } // GEN-LAST:event_cancelButtonActionPerformed
@Override public void commit() { MainWindow.getInstance() .command( "ask SquareObject " + array_num + " [set xcor " + xCoord + "]"); // move to desired location MainWindow.getInstance() .command("ask SquareObject " + array_num + " [set ycor " + yCoord + "]"); MainWindow.getInstance().command("ask SquareObject " + array_num + " [set size " + width + "]"); }
SquareObject(int _array_num, double _xCoord, double _yCoord, double _width, double mass) { super(_array_num, _xCoord, _yCoord, 0, 0, mass); array_num = _array_num; width = _width; restrained = false; // SquareObjects must be defined in nlogo file: "array [SquareObjects SquareObject]" MainWindow.getInstance().command("create-SquareObjects 1"); // create object at origin setShape("square"); commit(); // set location }
public void run() { while (true) { try { MainWindow.getInstance().comp.command(this.queue.take()); if (this.queue.size() == 0) { PhysicsEngine.getInstance().netLogoDoneUpdating(); } } catch (CompilerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@Override public void setShape(String shape) { MainWindow.getInstance() .command("ask SquareObject " + array_num + " [set shape \"" + shape + "\"]"); }