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

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

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

JButton.isDefaultButton介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-performance

@Override
public boolean accept(JComponent c) {
  return !(c instanceof JButton && ((JButton) c).isDefaultButton());
}

代码示例来源:origin: org.java.net.substance/substance

/**
 * Checks whether the specified button is pulsating.
 * 
 * @param jButton
 *            Button.
 * @return <code>true</code> if the specified button is pulsating,
 *         <code>false</code> otherwise.
 */
public static boolean isPulsating(JButton jButton) {
  // default button pulsates.
  boolean isDefault = jButton.isDefaultButton();
  if (isDefault) {
    return true;
  }
  return false;
  // attention-drawing close button pulsates.
  // return isAttentionDrawingCloseButton(jButton);
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Checks whether the specified button is pulsating.
 * 
 * @param jButton
 *            Button.
 * @return <code>true</code> if the specified button is pulsating,
 *         <code>false</code> otherwise.
 */
public static boolean isPulsating(JButton jButton) {
  // default button pulsates.
  boolean isDefault = jButton.isDefaultButton();
  if (isDefault) {
    return true;
  }
  return false;
  // attention-drawing close button pulsates.
  // return isAttentionDrawingCloseButton(jButton);
}

代码示例来源:origin: Revivius/nb-darcula

protected Paint getBackgroundPaint(JComponent c) {
  JButton b = (JButton) c;
  if (b.isDefaultButton()) {
    return new GradientPaint(
        0.0F, 0.0F, getSelectedButtonColor1(),
        0.0F, c.getHeight(), getSelectedButtonColor2()
    );
  }
  return new GradientPaint(
      0.0F, 0.0F, getButtonColor1(),
      0.0F, c.getHeight(), getButtonColor2()
  );
}

代码示例来源:origin: net.sf.nimrod/nimrod-laf

public void paintBorder( Component c, Graphics g, int x, int y, int w, int h) {
 if ( !((AbstractButton)c).isBorderPainted() ) {
  return;
 }
 
 g.translate( x, y);
 
 Graphics2D g2D = (Graphics2D)g;
 g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 
 g2D.setColor( NimRODLookAndFeel.getControlDarkShadow());
 g2D.drawRoundRect( 0,0, w-1,h-1, 8,8);
   
 if ( c instanceof JButton ) {
  JButton button = (JButton)c;
  //ButtonModel model = button.getModel();
  if ( button.isDefaultButton() ) {
   g2D.setColor( NimRODLookAndFeel.getControlDarkShadow().darker());
   g2D.drawRoundRect( 1,1, w-3,h-3, 7,7);
  }
  /*else if ( model.isPressed() && model.isArmed() ) {
   g.translate( x, y);
   g.setColor( NimRODLookAndFeel.getControlDarkShadow() );
   g.drawRoundRect( 0,0, w-1,h-1, 8,8);
  }*/
 }
 
 g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
}

代码示例来源:origin: Revivius/nb-darcula

@Override
public void update(Graphics g, JComponent c) {
  super.update(g, c);
  if (c instanceof JButton) {
    JButton b = (JButton) c;
    if (b.isDefaultButton() && !SystemInfo.isMac && !c.getFont().isBold()) {
      c.setFont(c.getFont().deriveFont(1));
    }
  }
}

代码示例来源:origin: Revivius/nb-darcula

protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
  AbstractButton button = (AbstractButton) c;
  ButtonModel model = button.getModel();
  Color fg = button.getForeground();
  if (((fg instanceof UIResource)) && ((button instanceof JButton)) && (((JButton) button).isDefaultButton())) {
    Color selectedFg = UIManager.getColor("Button.darcula.selectedButtonForeground");
    if (selectedFg != null) {
      fg = selectedFg;
    }
  }
  g.setColor(fg);
  FontMetrics metrics = SwingUtilities2.getFontMetrics(c, g);
  int mnemonicIndex = button.getDisplayedMnemonicIndex();
  if (model.isEnabled()) {
    SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, textRect.x
        + getTextShiftOffset(), textRect.y + metrics
        .getAscent() + getTextShiftOffset());
  } else {
    g.setColor(UIManager.getColor("Button.disabledText"));
    SwingUtilities2.drawStringUnderlineCharAt(c, g, text, -1, textRect.x
        + getTextShiftOffset(), textRect.y + metrics
        .getAscent() + getTextShiftOffset());
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/napkinlaf

@Override
protected void paintText(Graphics g, JComponent c, Rectangle textRect,
    String text) {
  if (line == null) {
    line = new DrawnLineHolder(new DrawnCubicLineGenerator());
  }
  boolean isDefault = ((JButton) c).isDefaultButton();
  NapkinUtil.paintButtonText(g, c, textRect, text, getTextShiftOffset(),
      line, isDefault, this);
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

if (b.isDefaultButton() && PgsUtils.hasFocus(b.getTopLevelAncestor())) {
  JButton defaultButton;
  if (defaultButtonRef == null) {

代码示例来源:origin: com.jidesoft/jide-oss

state |= FOCUSED;
if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
  state |= DEFAULT;

代码示例来源:origin: khuxtable/seaglass

if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
  state |= DEFAULT;

代码示例来源:origin: net.sf.tinylaf/tinylaf

boolean isDefault = (c instanceof JButton) && ((JButton)c).isDefaultButton();

代码示例来源:origin: net.sf.tinylaf/tinylaf

isDefaultButton = (c instanceof JButton) && (((JButton)c).isDefaultButton());
boolean isRollover = button.getModel().isRollover();
boolean isDefinedBackground = c.getBackground().equals(

代码示例来源:origin: ru.sbtqa/monte-media

&& borders[DEFAULT] != null
   && (c instanceof JButton)
   && ((JButton) c).isDefaultButton()) {
  border = borders[DEFAULT];
} else {

代码示例来源:origin: net.sf.tinylaf/tinylaf

boolean isDefault = (b instanceof JButton) && (((JButton)b).isDefaultButton());
boolean isSpinnerButton =
  Boolean.TRUE.equals(b.getClientProperty("isSpinnerButton"));

代码示例来源:origin: org.java.net.substance/substance

if (component instanceof JButton) {
  JButton jb = (JButton) component;
  if (jb.isDefaultButton()) {
    if (model.isEnabled()) {

代码示例来源:origin: com.github.insubstantial/substance

if (component instanceof JButton) {
  JButton jb = (JButton) component;
  if (jb.isDefaultButton()) {
    if (model.isEnabled()) {

相关文章

微信公众号

最新文章

更多

JButton类方法