/** * Sets the grid being displayed. Reset the cellSize to be the largest that fits the entire grid * in the current visible area (use default if grid is too large). * * @param gr the grid to display */ public void setGrid(Grid<?> gr) { currentLocation = new Location(0, 0); JViewport vp = getEnclosingViewport(); // before changing, reset // scroll/pan position if (vp != null) vp.setViewPosition(new Point(0, 0)); grid = gr; originRow = originCol = 0; if (grid.getNumRows() == -1 && grid.getNumCols() == -1) { numRows = numCols = 2000; // This determines the "virtual" size of the pan world } else { numRows = grid.getNumRows(); numCols = grid.getNumCols(); } recalculateCellSize(MIN_CELL_SIZE); }
public boolean isPannableUnbounded() { return grid != null && (grid.getNumRows() == -1 || grid.getNumCols() == -1); }