我使用此代码:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
我想覆盖MotifBorders的satic内部类 ButtonBorder 的 paintBorder 方法( MotifBorders )并使用它,但我保留了计划颜色,我不知道使用什么颜色最初由这个LAF(LookAndFeel)。
JButton jb = new JButton(someIcon);
BorderUIResource.CompoundBorderUIResource bc =
(BorderUIResource.CompoundBorderUIResource)jb.getBorder();
MotifBorders.ButtonBorder oldMotifBB =
(MotifBorders.ButtonBorder)bc.getOutsideBorder();
MotifBorders.ButtonBorder newMotifBB = new MotifBorders.ButtonBorder(
shadow,
highlight,
WHAT_ARGUMENT?, /*darkShadow (Originally No defined)*/
focus) {
@Override public void paintBorder(
Component c, Graphics g, int x, int y, int w, int h) {
//Changes Code
}
};
答案 0 :(得分:1)
选中此site
MotifBorders.ButtonBorder newMotifBB = new MotifBorders.ButtonBorder(
UIManager.getColor("Button.shadow"), /*shadow*/
UIManager.getColor("Button.highlight"), /*highlight*/
UIManager.getColor("Button.darkShadow"), /*darkShadow (Originally No defined)*/
UIManager.getColor("activeCaptionBorder") /*focus*/) {
@Override public void paintBorder(
Component c, Graphics g, int x, int y, int w, int h) {
//Changes Code
}
};