@Override protected void paintAnimation(Graphics2D gfx) { Object ohints = null; if (_antiAliased) { ohints = SwingUtil.activateAntiAliasing(gfx); } _label.render(gfx, _bounds.x, _bounds.y); if (_antiAliased) { SwingUtil.restoreAntiAliasing(gfx, ohints); } }
/** Test code. */ public static void main(String[] args) { JFrame frame = new JFrame("Board test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); AtlantiBoardView board = new AtlantiBoardView(null); TestDSet set = new TestDSet(); set.addTile(new AtlantiTile(CITY_TWO, true, WEST, 0, 0)); set.addTile(new AtlantiTile(CITY_TWO, false, WEST, -1, 1)); set.addTile(new AtlantiTile(CITY_ONE, false, SOUTH, -1, -1)); AtlantiTile zero = new AtlantiTile(CURVED_ROAD, false, WEST, 0, 2); set.addTile(zero); AtlantiTile one = new AtlantiTile(TWO_CITY_TWO, false, NORTH, 0, 1); set.addTile(one); set.addTile(new AtlantiTile(CITY_THREE, false, WEST, 1, 1)); set.addTile(new AtlantiTile(CITY_THREE_ROAD, false, EAST, 1, 2)); set.addTile(new AtlantiTile(CITY_THREE, false, NORTH, -1, 0)); AtlantiTile two = new AtlantiTile(CITY_ONE, false, EAST, -2, 0); set.addTile(two); board.tilesChanged(set); AtlantiTile placing = new AtlantiTile(CITY_TWO, false, NORTH, 0, 0); board.setTileToBePlaced(placing); // set a feature group to test propagation List<AtlantiTile> tiles = new ArrayList<AtlantiTile>(); CollectionUtil.addAll(tiles, set.iterator()); Collections.sort(tiles); zero.setPiecen(new Piecen(Piecen.GREEN, 0, 0, 2), tiles); one.setPiecen(new Piecen(Piecen.BLUE, 0, 0, 0), tiles); two.setPiecen(new Piecen(Piecen.RED, 0, 0, 1), tiles); Log.info("Incomplete road: " + TileUtil.computeFeatureScore(tiles, zero, 2)); Log.info("Completed city: " + TileUtil.computeFeatureScore(tiles, two, 1)); Log.info("Incomplete city: " + TileUtil.computeFeatureScore(tiles, one, 2)); frame.getContentPane().add(board, BorderLayout.CENTER); frame.pack(); SwingUtil.centerWindow(frame); frame.setVisible(true); }