001 /**
002 * An executable I threw together to make sure my UI components look right.
003 */
004
005 package test;
006
007 import java.awt.Color;
008 import java.awt.GridLayout;
009
010 import javax.swing.JFrame;
011 import javax.swing.JPanel;
012 import javax.swing.WindowConstants;
013
014 import rules.Empty;
015 import rules.King;
016 import rules.Knight;
017 import ui.SquarePanel;
018
019 public class SquarePanelChecker {
020 public static void main(String[] args) {
021 JFrame frame = new JFrame();
022 JPanel mainPanel = new JPanel();
023
024 mainPanel.setLayout(new GridLayout(2, 2));
025
026 SquarePanel red = new SquarePanel(Color.RED);
027 SquarePanel white = new SquarePanel(Color.WHITE);
028 SquarePanel blue = new SquarePanel(Color.BLACK);
029 mainPanel.add(red);
030 mainPanel.add(white);
031 mainPanel.add(blue);
032
033 frame.add(mainPanel);
034 frame.setSize(frame.getPreferredSize());
035
036 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
037 frame.setVisible(true);
038 frame.setSize(frame.getPreferredSize());
039
040 // Make sure a piece is displayed properly
041 red.setPiece(new Knight(core.Color.BLACK, 0));
042
043 // Make sure a piece is erased if it is removed from the square
044 white.setPiece(new King(core.Color.BLACK, 0));
045 white.setPiece(new Empty());
046
047 // Check selected effect
048 blue.setSelected(true);
049 }
050 }