398 /**
399 * As of Java 2 platform v 1.4 this method should not be used or overriden.
400 * Use the paintText method which takes the AbstractButton argument.
401 */
402 protected void paintText(final Graphics g, final JComponent c, final Rectangle localTextRect, final String text) {
403 final Graphics2D g2d = g instanceof Graphics2D ? (Graphics2D)g : null;
404
405 final AbstractButton b = (AbstractButton)c;
406 final ButtonModel model = b.getModel();
407 final FontMetrics fm = g.getFontMetrics();
408 final int mnemonicIndex = AquaMnemonicHandler.isMnemonicHidden() ? -1 : b.getDisplayedMnemonicIndex();
409
410 /* Draw the Text */
411 if (model.isEnabled()) {
412 /*** paint the text normally */
413 g.setColor(b.getForeground());
414 } else {
415 /*** paint the text disabled ***/
416 g.setColor(defaultDisabledTextColor);
417 }
418 SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, localTextRect.x, localTextRect.y + fm.getAscent());
419 }
420
421 protected void paintText(final Graphics g, final AbstractButton b, final Rectangle localTextRect, final String text) {
422 paintText(g, (JComponent)b, localTextRect, text);
423 }
424
425 protected void paintButtonPressed(final Graphics g, final AbstractButton b) {
426 paint(g, b);
427 }
428
429 // Layout Methods
430 public Dimension getMinimumSize(final JComponent c) {
431 final Dimension d = getPreferredSize(c);
432 final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
433 if (v != null) {
434 d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS);
435 }
436 return d;
437 }
438
|
398 /**
399 * As of Java 2 platform v 1.4 this method should not be used or overriden.
400 * Use the paintText method which takes the AbstractButton argument.
401 */
402 protected void paintText(final Graphics g, final JComponent c, final Rectangle localTextRect, final String text) {
403 final Graphics2D g2d = g instanceof Graphics2D ? (Graphics2D)g : null;
404
405 final AbstractButton b = (AbstractButton)c;
406 final ButtonModel model = b.getModel();
407 final FontMetrics fm = g.getFontMetrics();
408 final int mnemonicIndex = AquaMnemonicHandler.isMnemonicHidden() ? -1 : b.getDisplayedMnemonicIndex();
409
410 /* Draw the Text */
411 if (model.isEnabled()) {
412 /*** paint the text normally */
413 g.setColor(b.getForeground());
414 } else {
415 /*** paint the text disabled ***/
416 g.setColor(defaultDisabledTextColor);
417 }
418 getTextUIDrawing().drawStringUnderlineCharAt(c, g, text, mnemonicIndex,
419 localTextRect.x,
420 localTextRect.y + fm.getAscent());
421 }
422
423 protected void paintText(final Graphics g, final AbstractButton b, final Rectangle localTextRect, final String text) {
424 paintText(g, (JComponent)b, localTextRect, text);
425 }
426
427 protected void paintButtonPressed(final Graphics g, final AbstractButton b) {
428 paint(g, b);
429 }
430
431 // Layout Methods
432 public Dimension getMinimumSize(final JComponent c) {
433 final Dimension d = getPreferredSize(c);
434 final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
435 if (v != null) {
436 d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS);
437 }
438 return d;
439 }
440
|