📄 slightbevelborder.java
字号:
package view.common.statusbar;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.border.SoftBevelBorder;
public class SlightBevelBorder extends SoftBevelBorder {
private static final long serialVersionUID = 1L;
public SlightBevelBorder(int bevelType) {
super(bevelType);
}
public SlightBevelBorder(int bevelType, Color highlight, Color shadow) {
super(bevelType, highlight, shadow);
}
public void paintBorder(Component c, Graphics g, int x, int y, int width,
int height) {
Color oldColor = g.getColor();
g.translate(x, y);
if (bevelType == RAISED) {
g.setColor(getHighlightOuterColor(c));
g.drawLine(0, 0, width - 2, 0);
g.drawLine(0, 1, 0, height - 2);
g.setColor(getShadowOuterColor(c));
g.drawLine(0, height - 1, width - 1, height - 1);
g.drawLine(width - 1, 0, width - 1, height - 1);
} else if (bevelType == LOWERED) {
g.setColor(getShadowOuterColor(c));
g.drawLine(0, 0, width - 2, 0);
g.drawLine(0, 0, 0, height - 2);
g.setColor(getHighlightOuterColor(c));
g.drawLine(0, height - 1, width - 1, height - 1);
g.drawLine(width - 1, 0, width - 1, height);
}
g.translate(-x, -y);
g.setColor(oldColor);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -