Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jvnet.substance.utils.menu
Class MenuUtilities

    java.lang.Object
      org.jvnet.substance.utils.menu.MenuUtilities

    public class MenuUtilities

extends java.lang.Object

Menu-related utilities.

Author:
  Kirill Grouchnikov

Nested Class Summary
`static class` | `MenuUtilities.MenuLayoutInfo` Layout information for a single menu item.
`static class` | `MenuUtilities.MenuLayoutMetrics` Layout metrics for a single popup menu.
`static class` | `MenuUtilities.MenuPropertyListener` Listener to track changes in the menu items.

Field Summary
`static java.lang.String` | `LAYOUT_INFO`

Constructor Summary
`MenuUtilities()`

Method Summary
`static void` | `cleanPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu)` Cleans the layout metrics of the specified popup menu.
`static MenuUtilities.MenuLayoutInfo` | `getMenuLayoutInfo(javax.swing.JMenuItem menuItem, java.awt.Font acceleratorFont, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)` Returns the layout info for the specified menu item.
`protected static MenuUtilities.MenuLayoutMetrics` | `getMetrics(javax.swing.JPopupMenu popupMenu)` Returns the layout metrics of the specified popup menu.
`static MenuUtilities.MenuLayoutMetrics` | `getPopupLayoutMetrics(javax.swing.JMenuItem menuItem)` Returns the layout metrics of the popup menu of the specified menu item.
`static int` | `getPreferredWidth(javax.swing.JMenuItem menuItem)` Returns the preferred width of the specified menu item.
`static int` | `getTextOffset(javax.swing.JComponent menuItem, java.awt.Component menuItemParent)` Returns the text offset of the specified menu item.
`static void` | `paintMenuItem(java.awt.Graphics g, javax.swing.JMenuItem menuItem, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)` Paints the specified menu item.

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

Field Detail

### LAYOUT_INFO

    public static final java.lang.String LAYOUT_INFO

See Also:
  Constant Field Values

Constructor Detail

### MenuUtilities

    public MenuUtilities()

Method Detail

### getMenuLayoutInfo

    public static MenuUtilities.MenuLayoutInfo getMenuLayoutInfo(javax.swing.JMenuItem menuItem,
                                                                 java.awt.Font acceleratorFont,
                                                                 javax.swing.Icon checkIcon,
                                                                 javax.swing.Icon arrowIcon,
                                                                 int defaultTextIconGap)

  Returns the layout info for the specified menu item.

  Parameters:
    `menuItem` - Menu item.
    `acceleratorFont` - Font for the accelerator text.
    `checkIcon` - Check icon.
    `arrowIcon` - Arrow icon.
    `defaultTextIconGap` - Gap between the icon and the text.
  Returns:
    Layout info for the specified menu item.

### paintMenuItem

    public static void paintMenuItem(java.awt.Graphics g,
                                     javax.swing.JMenuItem menuItem,
                                     javax.swing.Icon checkIcon,
                                     javax.swing.Icon arrowIcon,
                                     int defaultTextIconGap)

  Paints the specified menu item.

  Parameters:
    `g` - Graphics context.
    `menuItem` - Menu item.
    `checkIcon` - Check icon.
    `arrowIcon` - Arrow icon.
    `defaultTextIconGap` - Gap between the icon and the text.

### getMetrics

    protected static MenuUtilities.MenuLayoutMetrics getMetrics(javax.swing.JPopupMenu popupMenu)

  Returns the layout metrics of the specified popup menu.

  Parameters:
    `popupMenu` - Popup menu.
  Returns:
    Layout metrics of the specified popup menu.

### getPopupLayoutMetrics

    public static MenuUtilities.MenuLayoutMetrics getPopupLayoutMetrics(javax.swing.JMenuItem menuItem)

  Returns the layout metrics of the popup menu of the specified menu item.

  Parameters:
    `menuItem` - Menu item.
  Returns:
    Layout metrics of the popup menu of the specified menu item.

### cleanPopupLayoutMetrics

    public static void cleanPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu)

  Cleans the layout metrics of the specified popup menu.

  Parameters:
    `popupMenu` - Popup menu.

### getPreferredWidth

    public static int getPreferredWidth(javax.swing.JMenuItem menuItem)

  Returns the preferred width of the specified menu item. The preferred width depends on the layout metrics of the entire popup menu of this menu item.

  Parameters:
    `menuItem` - Menu item.
  Returns:
    Preferred width of the specified menu item

### getTextOffset

    public static int getTextOffset(javax.swing.JComponent menuItem,
                                    java.awt.Component menuItemParent)

  Returns the text offset of the specified menu item.

  Parameters:
    `menuItem` - Menu item.
    `menuItemParent` - Menu item parent.
  Returns:
    Text offset of the specified menu item.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD