|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.wordpress.tipsforjava.swing.PopupMenuAlignment
public class PopupMenuAlignment extends Object
Convenience class to align the text of JMenuItems within a specified JPopupMenu to be either CENTER or TRAILING aligned. The default for trailing would be right aligned unless the component orientation is changed. The class can be used in one of two ways. For a static popup menu you can just invoke the statick alignText() method once the menu has been created. For dynamic popup menus you can use this class as a ContainerListener on the popup menu so as menu items are added or removed the remaining items are adjusted accordingly.
| Field Summary | |
|---|---|
static int |
CENTER
|
static int |
TRAILING
|
private int |
alignment
|
| Constructor Summary | |
PopupMenuAlignment(int alignment)
Use this class as a listener to handle dynamic changes to the popup menu. |
|
| Method Summary | |
|---|---|
static void
|
alignText(JPopupMenu popup, int alignment)
Align the menu items contained with the popup menu. |
void
|
componentAdded(ContainerEvent e)
|
void
|
componentRemoved(ContainerEvent e)
|
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
public static int CENTER
public static int TRAILING
private int alignment
| Constructor Detail |
|---|
public PopupMenuAlignment(int alignment)
alignment - alignment of each menu item. Either
CENTER or TRAILING
| Method Detail |
|---|
public static void alignText(JPopupMenu popup, int alignment)
popup - the popup menualignment - alignment of each menu item. Either
CENTER or TRAILING
public void componentAdded(ContainerEvent e)
public void componentRemoved(ContainerEvent e)
Groovy Documentation