summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/CustomBorder.java
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-04-29 16:25:32 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-04-29 16:25:32 +0200
commit96cb7454884ed896c0e3305e86212a5c01240d5f (patch)
tree695e971405d3f9fda0d9f660222bbcf8d3f56e98 /src/jrummikub/view/impl/CustomBorder.java
parent839e020f4bbd85a76a970cf7c56538a82e1075b6 (diff)
downloadJRummikub-96cb7454884ed896c0e3305e86212a5c01240d5f.tar
JRummikub-96cb7454884ed896c0e3305e86212a5c01240d5f.zip
Restructured view package
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@17 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/CustomBorder.java')
-rw-r--r--src/jrummikub/view/impl/CustomBorder.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/jrummikub/view/impl/CustomBorder.java b/src/jrummikub/view/impl/CustomBorder.java
new file mode 100644
index 0000000..3e79ce7
--- /dev/null
+++ b/src/jrummikub/view/impl/CustomBorder.java
@@ -0,0 +1,42 @@
+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);
+ }
+
+}