javax.swing.AbstractButton.getHeight()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(70)

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

AbstractButton.getHeight介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

private static void makeButtonPopup(final AbstractButton button, final JPopupMenu popup) {
    button.addActionListener(e -> popup.show(button, 0, button.getHeight()));
  }
}

代码示例来源:origin: magefree/mage

private static void makeButtonPopup(final AbstractButton button, final JPopupMenu popup) {
    button.addActionListener(e -> popup.show(button, 0, button.getHeight()));
  }
}

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

private void paintBackground(Graphics2D graphics, AbstractButton b) {
  Graphics2D g = (Graphics2D) graphics.create();
  try {
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
    Color startingColor = look.colors().shadow().brighter().brighter();
    Color endingColor = look.colors().shadow().darker();
    g.setPaint(new GradientPaint(0, 0, startingColor, 0, b.getHeight(), endingColor));
    g.fillRect(1, 1, b.getWidth()-2, b.getHeight()-2);
  } finally {
    g.dispose();
  }
}

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

@Override
protected void paintText(Graphics g, AbstractButton button, Rectangle textRect, String text) {
  Graphics2D g2d = createGraphics(g);
  try {
    g2d.setFont(FONT);
    FontMetrics metrics = g2d.getFontMetrics();
    int width = metrics.stringWidth(text);
    int descent = metrics.getDescent();
    int x = button.getWidth() / 2 - width / 2 + 1;
    int y = button.getHeight() / 2 + descent + 1;
    g2d.setColor(TEXT_LIGHT);
    g2d.drawString(text, ++x, ++y);
    g2d.setColor(TEXT_DARK);
    g2d.drawString(text, --x, --y);
  } finally {
    g2d.dispose();
  }
}

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

private void paintRoundBorder(Graphics2D g, AbstractButton b) {
  Color color = look.colors().shadow();
  g.setColor(color);
  g.drawRoundRect(0, 0, b.getWidth()-1, b.getHeight()-1, 4, 4);
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public void actionPerformed( ActionEvent e )
 {
  GotoExceptionTypePopup.display( _btnPlus, 0, _btnPlus.getHeight(), BreakpointsDialog.this::addExceptionBreakpoint );
 }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
  protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect,
      Rectangle iconRect) {
    int width = b.getWidth();
    int height = b.getHeight();
    g.setColor(getFocusColor());
    javax.swing.plaf.basic.BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY,
        width - dashedRectGapWidth,
        height - dashedRectGapHeight);
  }
});

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

protected void paintButtonPressed(Graphics g, AbstractButton b) {
    if (Boolean.TRUE.equals(b.getClientProperty("pgs.isFlat"))) {
      g.setColor(getSelectColor());
      g.fillRect(0, 0, b.getWidth(), b.getHeight());
    } else {
      PgsUtils.drawGradient(g, b, "selected", 1, 1, b.getWidth()-1, b.getHeight()-1);
    }
    PgsUtils.drawButtonBorder(g, 0, 0, b.getWidth()-1, b.getHeight()-1,
            (Color) b.getClientProperty("rolloverBorderColor"));
    super.paintButtonPressed(g, b);
  }
}

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

protected void paintButtonPressed(Graphics g, AbstractButton b) {
    if (Boolean.TRUE.equals(b.getClientProperty("pgs.isFlat"))) {
      g.setColor(getSelectColor());
      g.fillRect(0, 0, b.getWidth(), b.getHeight());
    } else {
      PgsUtils.drawGradient(g, b, "selected", 1, 1, b.getWidth()-1, b.getHeight()-1);
    }
    super.paintButtonPressed(g, b);
    PgsUtils.drawButtonBorder(g, 0, 0, b.getWidth()-1, b.getHeight()-1,
            (Color) b.getClientProperty("rolloverBorderColor"));
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect,
               Rectangle iconRect) {
    int width = b.getWidth();
    int height = b.getHeight();
    g.setColor(getFocusColor());
    javax.swing.plaf.basic.BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX_Local,
                                 dashedRectGapY_Local,
                                 width - dashedRectGapWidth_Local,
                                 height - dashedRectGapHeight_Local);
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect,
               Rectangle iconRect) {
    int width = b.getWidth();
    int height = b.getHeight();
    g.setColor(getFocusColor());
    javax.swing.plaf.basic.BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX_Local,
                                 dashedRectGapY_Local,
                                 width - dashedRectGapWidth_Local,
                                 height - dashedRectGapHeight_Local);
  }
});

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

protected void paintButtonPressed(Graphics g, AbstractButton b) {
    if (b.isContentAreaFilled()) {
      if (Boolean.TRUE.equals(b.getClientProperty("pgs.isFlat"))) {
        g.setColor(getSelectColor());
        g.fillRect(0, 0, b.getWidth(), b.getHeight());
      } else {
        PgsUtils.drawGradient(g, b, "selected");
      }
    }
  }
}

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

protected void paintButtonPressed(Graphics g, AbstractButton b) {
  if (b.isOpaque() && b.isContentAreaFilled()) {
    if (Boolean.TRUE.equals(b.getClientProperty("pgs.isFlat"))) {
      g.setColor(getSelectColor());
      g.fillRect(0, 0, b.getWidth(), b.getHeight());
    } else {
      PgsUtils.drawGradient(g, b, "selected");
    }
  }
}

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

protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
  if (!AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
    g.setColor(AbstractLookAndFeel.getFocusColor());
    BasicGraphicsUtils.drawDashedRect(g, 3, 2, b.getWidth() - 6, b.getHeight() - 5);
    BasicGraphicsUtils.drawDashedRect(g, 4, 3, b.getWidth() - 8, b.getHeight() - 7);
  }
}

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

protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
  if (!AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
    g.setColor(AbstractLookAndFeel.getFocusColor());
    BasicGraphicsUtils.drawDashedRect(g, 3, 2, b.getWidth() - 6, b.getHeight() - 5);
    BasicGraphicsUtils.drawDashedRect(g, 4, 3, b.getWidth() - 8, b.getHeight() - 7);
  }
}

代码示例来源:origin: stackoverflow.com

public void click(AbstractButton button, int millis) throws AWTException
{
  Point p = button.getLocationOnScreen();
  Robot r = new Robot();
  r.mouseMove(p.x + button.getWidth() / 2, p.y + button.getHeight() / 2);
  r.mousePress(InputEvent.BUTTON1_MASK);
  try { Thread.sleep(millis); } catch (Exception e) {}
  r.mouseRelease(InputEvent.BUTTON1_MASK);
}

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

protected void paintFocus( Graphics g, AbstractButton b,
                            Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
 if ( !b.isFocusPainted() || !oldOpaque ) {
  return;
 }
 if( b.getParent() instanceof JToolBar ) {
  return;  // No se pintael foco cuando estamos en una barra
 }
 
 NimRODUtils.paintFocus( g, 3,3, b.getWidth()-6, b.getHeight()-6, 2, 2, NimRODLookAndFeel.getFocusColor());
}

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

protected void paintFocus( Graphics g, AbstractButton b,
                            Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
 if ( !b.isFocusPainted() || !oldOpaque ) {
  return;
 }
 if ( b.getParent() instanceof JToolBar ) {
  return;  // No se pinta el foco cuando estamos en una barra
 }
 
 NimRODUtils.paintFocus( g, 3,3, b.getWidth()-6, b.getHeight()-6, 2, 2, NimRODLookAndFeel.getFocusColor());
}

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

public void refresh() {
 if ( papi != null && papi.getParent() != null ) {
  papi.getParent().repaint( papi.getX()-5, papi.getY()-5, 
               papi.getWidth()+10, papi.getHeight()+10);
 }
}

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

public void refresh() {
 if ( papi != null && papi.getParent() != null ) {
  papi.getParent().repaint( papi.getX()-5, papi.getY()-5, 
               papi.getWidth()+10, papi.getHeight()+10);
 }
}

相关文章

微信公众号

最新文章

更多

AbstractButton类方法