public void paintComponent(Graphics g) { Icon icon = getIcon(); FontMetrics fm = getFontMetrics(getFont()); Rectangle viewRect = new Rectangle(getSize()); JBInsets.removeFrom(viewRect, getInsets()); Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle(); String text = SwingUtilities.layoutCompoundLabel( this, fm, getText(), icon, SwingConstants.CENTER, horizontalTextAlignment(), SwingConstants.CENTER, horizontalTextPosition(), viewRect, iconRect, textRect, iconTextSpace()); ActionButtonLook look = ActionButtonLook.IDEA_LOOK; look.paintBackground(g, this); look.paintIconAt(g, this, icon, iconRect.x, iconRect.y); look.paintBorder(g, this); UISettings.setupAntialiasing(g); g.setColor(isButtonEnabled() ? getForeground() : getInactiveTextColor()); SwingUtilities2.drawStringUnderlineCharAt( this, g, text, getMnemonicCharIndex(text), textRect.x, textRect.y + fm.getAscent()); }
private Rectangle computePaintArea() { Rectangle area = new Rectangle(getWidth(), getHeight()); JBInsets.removeFrom(area, getInsets()); JBInsets.removeFrom(area, myIpad); return area; }