public class MenuUtilities
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
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.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LAYOUT_INFO |
| Constructor and Description |
|---|
MenuUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu)
Cleans the layout metrics of the specified popup menu.
|
static MenuUtilities.MenuLayoutInfo |
getMenuLayoutInfo(boolean forPainting,
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,
boolean forPainting)
Returns the layout metrics of the specified popup menu.
|
static MenuUtilities.MenuLayoutMetrics |
getPopupLayoutMetrics(javax.swing.JMenuItem menuItem,
boolean forPainting)
Returns the layout metrics of the popup menu of the specified menu item.
|
static MenuUtilities.MenuLayoutMetrics |
getPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu,
boolean forPainting) |
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.
|
public static final java.lang.String LAYOUT_INFO
public static MenuUtilities.MenuLayoutInfo getMenuLayoutInfo(boolean forPainting, javax.swing.JMenuItem menuItem, java.awt.Font acceleratorFont, javax.swing.Icon checkIcon, javax.swing.Icon arrowIcon, int defaultTextIconGap)
menuItem - Menu item.acceleratorFont - Font for the accelerator text.checkIcon - Check icon.arrowIcon - Arrow icon.defaultTextIconGap - Gap between the icon and the text.public static void paintMenuItem(java.awt.Graphics g,
javax.swing.JMenuItem menuItem,
javax.swing.Icon checkIcon,
javax.swing.Icon arrowIcon,
int defaultTextIconGap)
g - Graphics context.menuItem - Menu item.checkIcon - Check icon.arrowIcon - Arrow icon.defaultTextIconGap - Gap between the icon and the text.protected static MenuUtilities.MenuLayoutMetrics getMetrics(javax.swing.JPopupMenu popupMenu, boolean forPainting)
popupMenu - Popup menu.public static MenuUtilities.MenuLayoutMetrics getPopupLayoutMetrics(javax.swing.JMenuItem menuItem, boolean forPainting)
menuItem - Menu item.public static MenuUtilities.MenuLayoutMetrics getPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu, boolean forPainting)
public static void cleanPopupLayoutMetrics(javax.swing.JPopupMenu popupMenu)
popupMenu - Popup menu.public static int getPreferredWidth(javax.swing.JMenuItem menuItem)
menuItem - Menu item.public static int getTextOffset(javax.swing.JComponent menuItem,
java.awt.Component menuItemParent)
menuItem - Menu item.menuItemParent - Menu item parent.