@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()); }
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(); }
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); }
private BufferedImage createImage() { Dimension d = map.getSize(); return new BufferedImage(d.width + 1, d.height + 1, BufferedImage.TYPE_4BYTE_ABGR); }