| 1 | /* |
| 2 | * Copyright (c) 2005 The PseudoQ Project. |
| 3 | * |
| 4 | * This file is part of PseudoQ. |
| 5 | * |
| 6 | * PseudoQ is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Lesser General Public License as published by |
| 8 | * the Free Software Foundation; either version 2.1 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * PseudoQ is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public License |
| 17 | * along with PseudoQ; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | package net.sourceforge.pseudoq.gui; |
| 22 | |
| 23 | import java.awt.Color; |
| 24 | import java.awt.Dimension; |
| 25 | import java.awt.Graphics; |
| 26 | |
| 27 | /** |
| 28 | * GridPainter for MINI_X type puzzles. |
| 29 | * @author <a href="http://sourceforge.net/users/stevensa">Andrew Stevens</a> |
| 30 | */ |
| 31 | public class MiniXGridPainter extends AbstractGridPainter { |
| 32 | /** |
| 33 | * Creates a new instance of MiniXGridPainter. |
| 34 | */ |
| 35 | public MiniXGridPainter() { |
| 36 | } |
| 37 | |
| 38 | public void drawGrid(Graphics g) { |
| 39 | fillBox(g, 0, 0, 6, 6, Color.LIGHT_GRAY); |
| 40 | fillBox(g, 2, 2, 2, 2, Color.WHITE); |
| 41 | fillBox(g, 0, 0, 1, 1, Color.WHITE); |
| 42 | fillBox(g, 1, 1, 1, 1, Color.WHITE); |
| 43 | fillBox(g, 4, 4, 1, 1, Color.WHITE); |
| 44 | fillBox(g, 5, 5, 1, 1, Color.WHITE); |
| 45 | fillBox(g, 0, 5, 1, 1, Color.WHITE); |
| 46 | fillBox(g, 1, 4, 1, 1, Color.WHITE); |
| 47 | fillBox(g, 4, 1, 1, 1, Color.WHITE); |
| 48 | fillBox(g, 5, 0, 1, 1, Color.WHITE); |
| 49 | drawBox(g, 0, 0, 6, 6, 3, Color.BLACK); |
| 50 | drawLine(g, 3, 0, 3, 6, 3, Color.BLACK); |
| 51 | drawLine(g, 0, 2, 6, 2, 3, Color.BLACK); |
| 52 | drawLine(g, 0, 4, 6, 4, 3, Color.BLACK); |
| 53 | drawLine(g, 1, 0, 1, 6, 1, Color.BLACK); |
| 54 | drawLine(g, 2, 0, 2, 6, 1, Color.BLACK); |
| 55 | drawLine(g, 4, 0, 4, 6, 1, Color.BLACK); |
| 56 | drawLine(g, 5, 0, 5, 6, 1, Color.BLACK); |
| 57 | drawLine(g, 0, 1, 6, 1, 1, Color.BLACK); |
| 58 | drawLine(g, 0, 3, 6, 3, 1, Color.BLACK); |
| 59 | drawLine(g, 0, 5, 6, 5, 1, Color.BLACK); |
| 60 | } |
| 61 | |
| 62 | public Dimension getPreferredSize() { |
| 63 | int x = (2 * BORDER) + (6 * size); |
| 64 | return new Dimension(x, x); |
| 65 | } |
| 66 | |
| 67 | } |