我使用以下代码:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
我想覆盖MotifBorders(MotifBorders的另一个来源)的内部内部类ButtonBorder的paintBorder方法,并使用它,但是我保留了方案Colors,但我不知道此LAF最初使用了什么Colors(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
}
};
最佳答案
选中此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
}
};
关于java - Motif Borders.Button边框的默认方法未知参数的覆盖方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44271116/