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); } }