git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@13 72836036-5685-4462-b002-a69064685172
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package jrummikub.view;
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Graphics;
|
|
|
|
import javax.swing.ImageIcon;
|
|
import javax.swing.JPanel;
|
|
|
|
import jrummikub.model.Stone;
|
|
import jrummikub.model.StoneColor;
|
|
|
|
@SuppressWarnings("serial")
|
|
public class Board extends JPanel implements IBoard {
|
|
private final static ImageIcon background = new ImageIcon(Board.class.getResource("resource/wood.png"));
|
|
|
|
Board() {
|
|
super(true);
|
|
|
|
setBorder(new CustomBorder(Color.DARK_GRAY, 0, 1, 0, 1));
|
|
}
|
|
|
|
@Override
|
|
protected void paintComponent(Graphics g) {
|
|
for(int x = 0; x < getWidth(); x += background.getIconWidth()) {
|
|
background.paintIcon(this, g, x, 0);
|
|
}
|
|
|
|
// TODO Rest of painting code
|
|
|
|
// FIXME Test code
|
|
StonePainter.paintStone(g, new Stone(1, StoneColor.ORANGE, false),
|
|
0, 0, StonePainter.BOARD_SCALE);
|
|
StonePainter.paintStone(g, new Stone(10, StoneColor.BLUE, false),
|
|
1, 0, StonePainter.BOARD_SCALE);
|
|
StonePainter.paintStone(g, new Stone(5, StoneColor.RED, false),
|
|
0.5f, 1, StonePainter.BOARD_SCALE);
|
|
}
|
|
}
|