@Override protected void renderCellContent(Graphics g, String theFact) { String[] cellFacts = theFact.split(" "); if (!cellFacts[4].equals("b")) { g.setColor(Color.BLACK); CommonGraphics.fillWithString(g, cellFacts[4], 1.2); } }
@Override protected void renderCellContent(Graphics g, Set<String> theFacts) { if (theFacts.size() == 0) return; String theFact = theFacts.iterator().next(); String[] cellFacts = theFact.split(" "); if (cellFacts.length == 5) { String cellType = cellFacts[2]; int score = 10 * Integer.parseInt(cellFacts[3]); Color myColor = null; if (cellType.startsWith("red")) myColor = Color.red; if (cellType.startsWith("blue")) myColor = Color.blue; if (myColor == null) { System.err.println("Got weird piece: " + cellType); return; } g.setColor(myColor); CommonGraphics.fillWithString(g, "" + score, 1.5); } else { String cellType = cellFacts[4]; if (!cellType.equals("b")) { Color myColor = null; if (cellType.startsWith("red")) myColor = Color.red; if (cellType.startsWith("blue")) myColor = Color.blue; if (myColor == null) { System.err.println("Got weird piece: " + cellType); return; } int width = g.getClipBounds().width; int height = g.getClipBounds().height; g.setColor(myColor); g.fillOval(2, 2, width - 4, height - 4); CommonGraphics.drawChessPiece(g, "wn"); } } }
@Override protected final void renderCellBackground(Graphics g, int xCell, int yCell) { int width = g.getClipBounds().width; int height = g.getClipBounds().height; CommonGraphics.drawCellBorder(g); // Clear out the edges if (xCell == 1 || xCell == 7 || yCell == 1 || yCell == 7) { g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, width, height); } }