This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/src/jrummikub/view/impl/CustomBorder.java
Matthias Schiffer 96cb745488 Restructured view package
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@17 72836036-5685-4462-b002-a69064685172
2011-04-29 16:25:32 +02:00

42 lines
963 B
Java

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