我使用这段代码:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
我想覆盖MotifBorders(MotifBorders 的另一个来源)的satic内部类ButtonBorder的paintBorder方法并使用它,但我保留了方案颜色,我不知道这个 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
}
};