|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.utils.swing.menu.AbstractMenuGenerator
public abstract class AbstractMenuGenerator
This is a base generator class for custom menu generators. Menu generators are made to simplify various Swing menues creation.
Field Summary | |
---|---|
protected static java.lang.String |
defaultIconFormat
Default menu icons format. |
protected java.lang.String |
extension
Menu icons format. |
protected UnselectableButtonGroup |
group
Buttons grouping. |
protected java.lang.String |
languagePrefix
Menu language key prefix. |
protected java.lang.Class |
nearClass
Class near which menu icons are placed. |
protected java.lang.String |
path
Path to menu icons folder relative to class. |
Constructor Summary | |
---|---|
AbstractMenuGenerator()
|
Method Summary | |
---|---|
UnselectableButtonGroup |
closeGroup()
Finishes grouping menu items. |
WebCheckBoxMenuItem |
createCheckBoxItem(java.lang.String icon,
java.lang.String text,
HotkeyData hotkey,
boolean enabled,
boolean selected,
java.awt.event.ActionListener actionListener)
Returns newly created checkbox menu item. |
WebMenuItem |
createItem(java.lang.String icon,
java.lang.String text,
HotkeyData hotkey,
boolean enabled,
java.awt.event.ActionListener actionListener)
Returns newly created menu item. |
WebMenu |
createMenu(java.lang.String icon,
java.lang.String text,
boolean enabled,
java.awt.event.ActionListener actionListener)
Returns newly created menu. |
WebRadioButtonMenuItem |
createRadioButtonItem(java.lang.String icon,
java.lang.String text,
HotkeyData hotkey,
boolean enabled,
boolean selected,
java.awt.event.ActionListener actionListener)
Returns newly created radio button menu item. |
java.lang.String |
getExtension()
Returns menu icons format. |
javax.swing.ImageIcon |
getIcon(java.lang.String icon)
Returns icon for the specified name. |
java.lang.String |
getLanguageKey(java.lang.String text)
Returns menu item language key for the specified name. |
java.lang.String |
getLanguagePrefix()
Returns menu language key prefix. |
java.lang.Class |
getNearClass()
Returns class near which menu icons are placed. |
java.lang.String |
getPath()
Returns path to menu icons folder relative to class. |
UnselectableButtonGroup |
group(javax.swing.AbstractButton button)
Adds custom button into currently used buttons group. |
UnselectableButtonGroup |
openGroup()
Starts grouping menu items. |
UnselectableButtonGroup |
openGroup(boolean unselectable)
Starts grouping menu items. |
void |
setExtension(java.lang.String extension)
Sets menu icons format. |
void |
setIconSettings(java.lang.Class nearClass,
java.lang.String path,
java.lang.String extension)
Sets menu icons location and format. |
void |
setLanguagePrefix(java.lang.String prefix)
Sets menu language key prefix. |
void |
setNearClass(java.lang.Class nearClass)
Sets class near which menu icons are placed. |
void |
setPath(java.lang.String path)
Sets path to menu icons folder relative to class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String defaultIconFormat
protected java.lang.Class nearClass
protected java.lang.String path
protected java.lang.String extension
protected java.lang.String languagePrefix
protected UnselectableButtonGroup group
Constructor Detail |
---|
public AbstractMenuGenerator()
Method Detail |
---|
public java.lang.Class getNearClass()
public void setNearClass(java.lang.Class nearClass)
nearClass
- class near which menu icons are placedpublic java.lang.String getPath()
public void setPath(java.lang.String path)
path
- path to menu icons folder relative to classpublic java.lang.String getExtension()
public void setExtension(java.lang.String extension)
extension
- menu icons formatpublic void setIconSettings(java.lang.Class nearClass, java.lang.String path, java.lang.String extension)
nearClass
- class near which menu icons are placedpath
- path to menu icons folder relative to classextension
- menu icons formatpublic java.lang.String getLanguagePrefix()
public void setLanguagePrefix(java.lang.String prefix)
prefix
- menu language key prefixpublic java.lang.String getLanguageKey(java.lang.String text)
text
- menu item name or text
public WebMenuItem createItem(java.lang.String icon, java.lang.String text, HotkeyData hotkey, boolean enabled, java.awt.event.ActionListener actionListener)
icon
- menu item icontext
- menu item texthotkey
- menu item acceleratorenabled
- whether menu item is enabled or notactionListener
- menu item action listener
public WebCheckBoxMenuItem createCheckBoxItem(java.lang.String icon, java.lang.String text, HotkeyData hotkey, boolean enabled, boolean selected, java.awt.event.ActionListener actionListener)
icon
- checkbox menu item icontext
- checkbox menu item texthotkey
- checkbox menu item acceleratorenabled
- whether checkbox menu item is enabled or notselected
- whether checkbox menu item is selected or notactionListener
- checkbox menu item action listener
public WebRadioButtonMenuItem createRadioButtonItem(java.lang.String icon, java.lang.String text, HotkeyData hotkey, boolean enabled, boolean selected, java.awt.event.ActionListener actionListener)
icon
- radio button menu item icontext
- radio button menu item texthotkey
- radio button menu item acceleratorenabled
- whether radio button menu item is enabled or notselected
- whether radio button menu item is selected or notactionListener
- radio button menu item action listener
public WebMenu createMenu(java.lang.String icon, java.lang.String text, boolean enabled, java.awt.event.ActionListener actionListener)
icon
- menu icontext
- menu textenabled
- whether menu is enabled or notactionListener
- menu action listener
public UnselectableButtonGroup openGroup()
closeGroup()
call will get grouped.
public UnselectableButtonGroup openGroup(boolean unselectable)
closeGroup()
call will get grouped.
unselectable
- whether items should be unselectable or not
public UnselectableButtonGroup group(javax.swing.AbstractButton button)
button
- custom button to add into buttons group
public UnselectableButtonGroup closeGroup()
public javax.swing.ImageIcon getIcon(java.lang.String icon)
icon
- icon name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |