diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-02 05:12:50 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-02 05:12:50 +0200 |
commit | a9cf0d8c8fb5b489f07e4cc408cc5edf413ce26e (patch) | |
tree | 28c9c13383315d3daff8c7731c9064c4bbe543b0 /src/jrummikub/view | |
parent | 1e7cdb33f5bfce2d3fb174abd778788108557078 (diff) | |
download | JRummikub-a9cf0d8c8fb5b489f07e4cc408cc5edf413ce26e.tar JRummikub-a9cf0d8c8fb5b489f07e4cc408cc5edf413ce26e.zip |
Replace CustomBorder by MatteBorder
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@65 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/impl/Board.java | 3 | ||||
-rw-r--r-- | src/jrummikub/view/impl/CustomBorder.java | 43 | ||||
-rw-r--r-- | src/jrummikub/view/impl/View.java | 5 |
3 files changed, 5 insertions, 46 deletions
diff --git a/src/jrummikub/view/impl/Board.java b/src/jrummikub/view/impl/Board.java index 864b764..b6d92a8 100644 --- a/src/jrummikub/view/impl/Board.java +++ b/src/jrummikub/view/impl/Board.java @@ -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() { diff --git a/src/jrummikub/view/impl/CustomBorder.java b/src/jrummikub/view/impl/CustomBorder.java deleted file mode 100644 index eae0589..0000000 --- a/src/jrummikub/view/impl/CustomBorder.java +++ /dev/null @@ -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); - } - -} diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 0eabd43..2d09b05 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -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() { |