1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-05 08:55:08 -05:00
filebot/source/net/sourceforge/tuned/ui/RoundBorder.java
Reinhard Pointner 916f168d98 + added support for subtitle download via video/movie hash
* added video/subtitle file drop target in SubtitlePanel
* added VideoHashSubtitleDownloadDialog
2009-10-21 22:39:02 +00:00

74 lines
1.5 KiB
Java

package net.sourceforge.tuned.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
import javax.swing.border.AbstractBorder;
public class RoundBorder extends AbstractBorder {
private final Color color;
private final Insets insets;
private final int arc;
public RoundBorder() {
this.color = new Color(0xACACAC);
this.arc = 12;
this.insets = new Insets(1, 1, 1, 1);
}
public RoundBorder(Color color, int arc, Insets insets) {
this.color = color;
this.arc = arc;
this.insets = insets;
}
@Override
public boolean isBorderOpaque() {
return false;
}
@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.setPaint(c.getBackground());
g2d.fillRoundRect(x, y, width - 1, height - 1, arc, arc);
g2d.setPaint(color);
g2d.drawRoundRect(x, y, width - 1, height - 1, arc, arc);
g2d.dispose();
}
@Override
public Insets getBorderInsets(Component c) {
return new Insets(insets.top, insets.left, insets.bottom, insets.right);
}
@Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.top = this.insets.top;
insets.left = this.insets.left;
insets.bottom = this.insets.bottom;
insets.right = this.insets.right;
return insets;
}
}