Replace CustomBorder by MatteBorder
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@65 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
1e7cdb33f5
commit
a9cf0d8c8f
3 changed files with 5 additions and 46 deletions
|
@ -14,6 +14,7 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import jrummikub.model.Position;
|
||||
import jrummikub.model.Stone;
|
||||
|
@ -39,7 +40,7 @@ class Board extends StonePanel implements IBoard {
|
|||
private Collection<Stone> selectedStones = Collections.emptyList();
|
||||
|
||||
Board() {
|
||||
setBorder(new CustomBorder(Color.DARK_GRAY, 0, 1, 0, 1));
|
||||
setBorder(new MatteBorder(0, 1, 0, 1, Color.DARK_GRAY));
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package jrummikub.view.impl;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
|
||||
class CustomBorder implements Border {
|
||||
private Color color;
|
||||
private int top, left, bottom, right;
|
||||
|
||||
public CustomBorder(Color color, int top, int left, int bottom, int right) {
|
||||
this.color = color;
|
||||
this.top = top;
|
||||
this.left = left;
|
||||
this.bottom = bottom;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return new Insets(top, left, bottom, right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
g.setColor(color);
|
||||
|
||||
g.fillRect(x, y, width, top);
|
||||
g.fillRect(x, y + height - bottom, width, bottom);
|
||||
g.fillRect(x, y, left, height);
|
||||
g.fillRect(x + width - right, y, right, height);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.awt.event.ComponentEvent;
|
|||
import java.util.Collection;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.border.MatteBorder;
|
||||
|
||||
import jrummikub.model.Stone;
|
||||
import jrummikub.view.IPlayerPanel;
|
||||
|
@ -45,8 +46,8 @@ public class View extends JFrame implements IView {
|
|||
add(table);
|
||||
|
||||
playerPanel = new PlayerPanel();
|
||||
playerPanel.setBorder(new CustomBorder(Color.BLACK,
|
||||
PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0));
|
||||
playerPanel.setBorder(new MatteBorder(PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0,
|
||||
Color.BLACK));
|
||||
add(playerPanel);
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
|
|
Reference in a new issue