Exemplo n.º 1
0
  /** Update the size of the grid in the active tab */
  public void updateGridSize() {

    myGridSpinner = new GridSpinner(myGrid.getSize().width, myGrid.getSize().height);
    int a =
        (int)
            JOptionPane.showConfirmDialog(
                null, myGridSpinner, "Update Grid Height and Width", JOptionPane.OK_CANCEL_OPTION);
    if (a == 0) {
      process(
          CommandConstants.CHANGE_GRID_SIZE
              + " "
              + myGridSpinner.getGridWidth()
              + ", "
              + myGridSpinner.getGridHeight());
    }
  }
Exemplo n.º 2
0
 /**
  * Paint the contents of the canvas.
  *
  * <p>Never called by you directly, instead called by Java runtime when area of screen covered by
  * this container needs to be displayed (i.e., creation, uncovering, change in status)
  *
  * @param pen used to paint shape on the screen
  */
 @Override
 public void paintComponent(Graphics pen) {
   pen.setColor(Color.WHITE);
   pen.fillRect(0, 0, getSize().width, getSize().height);
   if (myGrid != null) {
     myGrid.paint((Graphics2D) pen);
   }
 }
Exemplo n.º 3
0
 @Override
 public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
   return myGrid.getScrollableBlockIncrement(visibleRect, orientation, direction);
 }
Exemplo n.º 4
0
 @Override
 public void setRenderable(Renderable<LevelEditing> r) {
   myGrid = (LEGrid) r;
   setSize(myGrid.getPixelSize());
   repaint();
 }
Exemplo n.º 5
0
 /**
  * checks if grid is ready for simulation
  *
  * @return true if valid
  */
 public boolean isValidForSimulation() {
   return myGrid.isValidForSimulation();
 }