MotifBorders.ButtonBorder的Overrriding方法unkow默认参数

时间:2017-05-30 20:13:58

标签: java swing override look-and-feel motif

我使用此代码:

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
  }
};

1 个答案:

答案 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
  }
};