javax.swing.JButton.getRootPane()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中javax.swing.JButton.getRootPane()方法的一些代码示例,展示了JButton.getRootPane()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getRootPane()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getRootPane

JButton.getRootPane介绍

暂无

代码示例

代码示例来源:origin: com.jtattoo/JTattoo

public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
  AbstractButton button = (AbstractButton) c;
  ButtonModel model = button.getModel();
  Color frameColor = ColorHelper.darker(button.getBackground(), 30);
  if (model.isEnabled()) {
    if ((model.isPressed() && model.isArmed()) || model.isSelected()) {
      g.setColor(frameColor);
      g.drawRect(x, y, w - 1, h - 1);
    } else {
      g.setColor(frameColor);
      g.drawRect(x, y, w - 1, h - 1);
      g.setColor(ColorHelper.brighter(button.getBackground(), 40));
      g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
      g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
    }
    if (c instanceof JButton) {
      JButton b = (JButton) c;
      if (b.getRootPane() != null && b.equals(b.getRootPane().getDefaultButton())) {
        g.setColor(defaultFrameColor);
        g.drawRect(x, y, w - 1, h - 1);
      }
    }
  } else {
    g.setColor(AbstractLookAndFeel.getDisabledForegroundColor());
    g.drawRect(x, y, w - 1, h - 1);
  }
}

代码示例来源:origin: freeplane/freeplane

public void actionPerformed(final ActionEvent arg0) {
  final Color result = ColorTracker.showCommonJColorChooserDialog(mButton.getRootPane(), TextUtils
    .getOptionalText(getLabel()), getColorValue(), ColorUtils.stringToColor(defaultColor));
  if(result != null){
    setColorValue(result);
    firePropertyChangeEvent();
  }
}

代码示例来源:origin: org.jclarion/clarion-runtime

button.getRootPane().setDefaultButton(button);

相关文章

微信公众号

最新文章

更多

JButton类方法