com.jgoodies.looks.common
Class MenuItemRenderer

java.lang.Object
  extended bycom.jgoodies.looks.common.MenuItemRenderer

public final class MenuItemRenderer
extends Object

Renders and lays out menu items.

Version:
$Revision: 1.4 $
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
 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


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