I want make JFrame border transparent, so I am trying to do so using my own Border class...
private class ShadowBorder extends AbstractBorder {
private static final int RADIUS = 30;
@Override
public boolean isBorderOpaque() {
return false;
}
@Override
public Insets getBorderInsets(Component c) {
return new Insets(RADIUS, RADIUS, RADIUS, RADIUS);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.top = RADIUS;
insets.left = RADIUS;
insets.bottom = RADIUS;
insets.right = RADIUS;
return insets;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(new Color(0x66000000, true));
g2d.fillRect(0, 0, width - RADIUS, RADIUS);
}
}
but border is not transparent in final. There is also white background inside of border, but I do not know why (see atach. image). Any ideas?
Thanks!