paintText(g, b, b.getBounds(), b.getText()); g.setColor(Color.red.brighter()); g.fillRect(0, 0, b.getSize().width, b.getSize().height);
public void superPaintText(Graphics g, JComponent c, Rectangle textRect, String text) { super.paintText(g, c, textRect, text); }
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { super.paintText(g, b, textRect, text); ButtonModel model = b.getModel(); if (model.isRollover()) { g.drawLine((int) (textRect.getX() + 1), (int) (textRect.getY() + textRect.getHeight() - 1), (int) (textRect.getX() + textRect.getWidth() - 1), (int) (textRect.getY() + textRect.getHeight() - 1)); b.setCursor(new Cursor(Cursor.HAND_CURSOR)); } }
/** * {@inheritDoc} <p> * Overridden to paint the underline on rollover. */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { //kgs -- SwingX #415: pixel-shift when disabled //BasicButtonUI shifts disabled text to the left by 1 pixel //we compensate for that here, so that all Hyperlinks paint //at the same location regardless of state if (!b.getModel().isEnabled()) { textRect.x += 1; } super.paintText(g, b, textRect, text); if (b.getModel().isRollover()) { paintUnderline(g, b, textRect, text); } }
/** * {@inheritDoc} <p> * Overridden to paint the underline on rollover. */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { //kgs -- SwingX #415: pixel-shift when disabled //BasicButtonUI shifts disabled text to the left by 1 pixel //we compensate for that here, so that all Hyperlinks paint //at the same location regardless of state if (!b.getModel().isEnabled()) { textRect.x += 1; } super.paintText(g, b, textRect, text); if (b.getModel().isRollover()) { paintUnderline(g, b, textRect, text); } }
/** * {@inheritDoc} <p> * Overridden to paint the underline on rollover. */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { //kgs -- SwingX #415: pixel-shift when disabled //BasicButtonUI shifts disabled text to the left by 1 pixel //we compensate for that here, so that all Hyperlinks paint //at the same location regardless of state if (!b.getModel().isEnabled()) { textRect.x += 1; } super.paintText(g, b, textRect, text); if (b.getModel().isRollover()) { paintUnderline(g, b, textRect, text); } }
/** * {@inheritDoc} <p> * Overridden to paint the underline on rollover. */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { //kgs -- SwingX #415: pixel-shift when disabled //BasicButtonUI shifts disabled text to the left by 1 pixel //we compensate for that here, so that all Hyperlinks paint //at the same location regardless of state if (!b.getModel().isEnabled()) { textRect.x += 1; } super.paintText(g, b, textRect, text); if (b.getModel().isRollover()) { paintUnderline(g, b, textRect, text); } }
/** * {@inheritDoc} <p> * Overridden to paint the underline on rollover. */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { //kgs -- SwingX #415: pixel-shift when disabled //BasicButtonUI shifts disabled text to the left by 1 pixel //we compensate for that here, so that all Hyperlinks paint //at the same location regardless of state if (!b.getModel().isEnabled()) { textRect.x += 1; } super.paintText(g, b, textRect, text); if (b.getModel().isRollover()) { paintUnderline(g, b, textRect, text); } }