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

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

本文整理了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

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

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

  1. /**
  2. * Checks whether the specified button is pulsating.
  3. *
  4. * @param jButton
  5. * Button.
  6. * @return <code>true</code> if the specified button is pulsating,
  7. * <code>false</code> otherwise.
  8. */
  9. public static boolean isPulsating(JButton jButton) {
  10. // default button pulsates.
  11. boolean isDefault = jButton.isDefaultButton();
  12. if (isDefault) {
  13. return true;
  14. }
  15. return false;
  16. // attention-drawing close button pulsates.
  17. // return isAttentionDrawingCloseButton(jButton);
  18. }

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

  1. /**
  2. * Checks whether the specified button is pulsating.
  3. *
  4. * @param jButton
  5. * Button.
  6. * @return <code>true</code> if the specified button is pulsating,
  7. * <code>false</code> otherwise.
  8. */
  9. public static boolean isPulsating(JButton jButton) {
  10. // default button pulsates.
  11. boolean isDefault = jButton.isDefaultButton();
  12. if (isDefault) {
  13. return true;
  14. }
  15. return false;
  16. // attention-drawing close button pulsates.
  17. // return isAttentionDrawingCloseButton(jButton);
  18. }

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

  1. protected Paint getBackgroundPaint(JComponent c) {
  2. JButton b = (JButton) c;
  3. if (b.isDefaultButton()) {
  4. return new GradientPaint(
  5. 0.0F, 0.0F, getSelectedButtonColor1(),
  6. 0.0F, c.getHeight(), getSelectedButtonColor2()
  7. );
  8. }
  9. return new GradientPaint(
  10. 0.0F, 0.0F, getButtonColor1(),
  11. 0.0F, c.getHeight(), getButtonColor2()
  12. );
  13. }

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

  1. public void paintBorder( Component c, Graphics g, int x, int y, int w, int h) {
  2. if ( !((AbstractButton)c).isBorderPainted() ) {
  3. return;
  4. }
  5. g.translate( x, y);
  6. Graphics2D g2D = (Graphics2D)g;
  7. g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  8. g2D.setColor( NimRODLookAndFeel.getControlDarkShadow());
  9. g2D.drawRoundRect( 0,0, w-1,h-1, 8,8);
  10. if ( c instanceof JButton ) {
  11. JButton button = (JButton)c;
  12. //ButtonModel model = button.getModel();
  13. if ( button.isDefaultButton() ) {
  14. g2D.setColor( NimRODLookAndFeel.getControlDarkShadow().darker());
  15. g2D.drawRoundRect( 1,1, w-3,h-3, 7,7);
  16. }
  17. /*else if ( model.isPressed() && model.isArmed() ) {
  18. g.translate( x, y);
  19. g.setColor( NimRODLookAndFeel.getControlDarkShadow() );
  20. g.drawRoundRect( 0,0, w-1,h-1, 8,8);
  21. }*/
  22. }
  23. g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
  24. }

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

  1. @Override
  2. public void update(Graphics g, JComponent c) {
  3. super.update(g, c);
  4. if (c instanceof JButton) {
  5. JButton b = (JButton) c;
  6. if (b.isDefaultButton() && !SystemInfo.isMac && !c.getFont().isBold()) {
  7. c.setFont(c.getFont().deriveFont(1));
  8. }
  9. }
  10. }

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

  1. protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
  2. AbstractButton button = (AbstractButton) c;
  3. ButtonModel model = button.getModel();
  4. Color fg = button.getForeground();
  5. if (((fg instanceof UIResource)) && ((button instanceof JButton)) && (((JButton) button).isDefaultButton())) {
  6. Color selectedFg = UIManager.getColor("Button.darcula.selectedButtonForeground");
  7. if (selectedFg != null) {
  8. fg = selectedFg;
  9. }
  10. }
  11. g.setColor(fg);
  12. FontMetrics metrics = SwingUtilities2.getFontMetrics(c, g);
  13. int mnemonicIndex = button.getDisplayedMnemonicIndex();
  14. if (model.isEnabled()) {
  15. SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, textRect.x
  16. + getTextShiftOffset(), textRect.y + metrics
  17. .getAscent() + getTextShiftOffset());
  18. } else {
  19. g.setColor(UIManager.getColor("Button.disabledText"));
  20. SwingUtilities2.drawStringUnderlineCharAt(c, g, text, -1, textRect.x
  21. + getTextShiftOffset(), textRect.y + metrics
  22. .getAscent() + getTextShiftOffset());
  23. }
  24. }

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

  1. @Override
  2. protected void paintText(Graphics g, JComponent c, Rectangle textRect,
  3. String text) {
  4. if (line == null) {
  5. line = new DrawnLineHolder(new DrawnCubicLineGenerator());
  6. }
  7. boolean isDefault = ((JButton) c).isDefaultButton();
  8. NapkinUtil.paintButtonText(g, c, textRect, text, getTextShiftOffset(),
  9. line, isDefault, this);
  10. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. if (component instanceof JButton) {
  2. JButton jb = (JButton) component;
  3. if (jb.isDefaultButton()) {
  4. if (model.isEnabled()) {

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

  1. if (component instanceof JButton) {
  2. JButton jb = (JButton) component;
  3. if (jb.isDefaultButton()) {
  4. if (model.isEnabled()) {

相关文章

JButton类方法