Пример #1
0
 @Override
 public void setMap(Map map) {
   this.map = map;
   setPreferredSize(map.getSize()); // Don't remove it.
   setSize(map.getSize()); // Don't remove it. use to SnapshotPanel
   map.addUndoableEditListener(undoManager);
   mapBounds = new Rectangle();
   mapBounds.setSize(map.getLogicalSize());
 }
Пример #2
0
  protected void updateBounds() {
    Dimension mapSize = map.getSize();
    Dimension panelSize = getSize();

    bounds.x = (mapSize.width >= panelSize.width) ? 0 : (panelSize.width - mapSize.width) / 2;
    ;
    bounds.y = (mapSize.height >= panelSize.height) ? 0 : (panelSize.height - mapSize.height) / 2;

    bounds.width = mapSize.width;
    bounds.height = mapSize.height;

    repaint();
  }
Пример #3
0
  public AbstractEditorView(Map map) {
    setMap(map);

    selection = new EditorSelection();
    bounds = new Rectangle();
    Dimension d = map.getSize();
    bounds.width = d.width;
    bounds.height = d.height;

    initBufferImage();
    addComponentListener(resizeListener);

    //		setDoubleBuffered(true);
  }
Пример #4
0
 private BufferedImage createImage() {
   Dimension d = map.getSize();
   return new BufferedImage(d.width + 1, d.height + 1, BufferedImage.TYPE_4BYTE_ABGR);
 }