package op.tools;
import javax.swing.border.Border;
import java.awt.*;
/**
* Created by tloehr on 03.07.14.
*/
// http://stackoverflow.com/questions/423950/java-rounded-swing-jbutton
public class RoundedBorder implements Border {
private int radius;
public RoundedBorder(int radius) {
this.radius = radius;
}
public Insets getBorderInsets(Component c) {
return new Insets(5, 5, 5, 5); // this.radius + 1, this.radius + 1, this.radius + 2, this.radius
}
public boolean isBorderOpaque() {
return true;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.drawRoundRect(x, y, width - 1, height - 1, radius, radius);
}
}