Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.plaf.common
Class MenuItemRenderer

    java.lang.Object
      com.jgoodies.plaf.common.MenuItemRenderer

public final class MenuItemRenderer
extends Object

Renders and lays out menu items.

Author:
  Karsten Lentzsch

Field Summary
`protected static String` | `HTML_KEY`

Constructor Summary
`MenuItemRenderer(JMenuItem menuItem, boolean iconBorderEnabled, Font acceleratorFont, Color selectionForeground, Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground)` Constructs a MenuItemRenderer for the specified menu item and settings.

Method Summary
`static void` | `drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x, int y)` Draws a string with the graphics `g` at location (`x`, `y`) just like `g.drawString` would.
`Dimension` | `getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)`
`void` | `paintBackground(Graphics g, JMenuItem aMenuItem, Color bgColor)` Draws the background of the menu item.
`void` | `paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)`
`void` | `paintText(Graphics g, JMenuItem aMenuItem, Rectangle textRectangle, String text)` Renders the text of the current menu item.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HTML_KEY

    protected static final String HTML_KEY

See Also:
  Constant Field Values

Constructor Detail

### MenuItemRenderer

    public MenuItemRenderer(JMenuItem menuItem,
                            boolean iconBorderEnabled,
                            Font acceleratorFont,
                            Color selectionForeground,
                            Color disabledForeground,
                            Color acceleratorForeground,
                            Color acceleratorSelectionForeground)

  Constructs a MenuItemRenderer for the specified menu item and settings.

Method Detail

### getPreferredMenuItemSize

    public Dimension getPreferredMenuItemSize(JComponent c,
                                              Icon checkIcon,
                                              Icon arrowIcon,
                                              int defaultTextIconGap)

### paintMenuItem

    public void paintMenuItem(Graphics g,
                              JComponent c,
                              Icon checkIcon,
                              Icon arrowIcon,
                              Color background,
                              Color foreground,
                              int defaultTextIconGap)

### paintBackground

    public void paintBackground(Graphics g,
                                JMenuItem aMenuItem,
                                Color bgColor)

  Draws the background of the menu item. Copied from 1.4.1 BasicMenuItem to make it visible to the MenuItemLayouter

  Parameters:
    `g` - the paint graphics
    `aMenuItem` - menu item to be painted
    `bgColor` - selection background color
  Since:
    1.4

### paintText

    public void paintText(Graphics g,
                          JMenuItem aMenuItem,
                          Rectangle textRectangle,
                          String text)

  Renders the text of the current menu item.

  Parameters:
    `g` - graphics context
    `aMenuItem` - menu item to render
    `textRectangle` - bounding rectangle for rendering the text
    `text` - string to render
  Since:
    1.4

### drawStringUnderlineCharAt

    public static void drawStringUnderlineCharAt(Graphics g,
                                                 String text,
                                                 int underlinedIndex,
                                                 int x,
                                                 int y)

  Draws a string with the graphics `g` at location (`x`, `y`) just like `g.drawString` would. The character at index `underlinedIndex` in text will be underlined. If `index` is beyond the bounds of `text` (including < 0), nothing will be underlined.

  Parameters:
    `g` - Graphics to draw with
    `text` - String to draw
    `underlinedIndex` - Index of character in text to underline
    `x` - x coordinate to draw at
    `y` - y coordinate to draw at
  Since:
    1.4

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2004 JGoodies Karsten Lentzsch. All Rights Reserved.