public class G9Menu extends JMenu
JMenu.AccessibleJMenu, JMenu.WinListenerJMenuItem.AccessibleJMenuItemAbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListenerJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
CUSTOM_MENU
Constant denoting that the menu is a custom menu
|
static int |
EDIT_MENU
Constant denoting that the menu is an edit menu.
|
static int |
FILE_MENU
Constant denoting that the menu is a file menu
|
static int |
HELP_MENU
Constant denoting that the menu is a help menu
|
static int |
VIEW_MENU
Constant denoting that the menu is a view menu.
|
static int |
WINDOW_MENU
Constant denoting that the menu is a window menu
|
popupListeneractionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTYlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
G9Menu(Action a,
int menuType)
Constructs a new
JMenu whose properties are taken from the
Action supplied. |
G9Menu(String s,
boolean b,
int menuType)
Constructs a new
JMenu with the supplied string as its text
and specified as a tear-off menu or not. |
G9Menu(String title,
int menuType)
Constructs a new
JMenu with the supplied string as its
title. |
G9Menu(String title,
int menuType,
String name)
Constructs a new
G9Menu with the supplied title and
name. |
| Modifier and Type | Method and Description |
|---|---|
Component |
add(Component c)
Appends a component to the end of this menu and removes consecutive
separators if
setRemoveConsecutiveSeparators(boolean) is set. |
JMenuItem |
addG9Item(JMenuItem item)
Adds a menu item to this menu.
|
Component |
addG9Item(JSeparator separator)
Adds a separator to this menu.
|
JMenuItem |
addG9Item(String title)
Creates a new menu item with the specified title and adds it to the menu.
|
JMenuItem |
addG9Item(String title,
String name)
Creates a new menu item with the specified title and adds it to the menu.
|
protected void |
createMenuComponents()
Dynamicly creates the menu.
|
protected static G9MenuItem |
createMenuItem(Action action,
String accelerator,
String title)
Creates a menu item based on the given arguments.
|
Component[] |
getG9Components()
Returns an array containing all components added by one of the
addG9Item-methods.
|
int |
getMenuType()
Reurns the menu type of this menu.
|
protected G9DialogFrame |
getParentFrame()
Returns the parent frame to this menu.
|
boolean |
isModal()
Return
true if this menu is modal otherwise
false. |
boolean |
isRemoveConsecutiveSeparators()
Return true if consecutive separators are to be reduced to one
|
boolean |
mergeMenu(G9Menu menu)
Merges the specified menu with this menu.
|
protected void |
setDefaultItem(List<?> defaultItems)
The argument list is used as the default menu items for this menu.
|
void |
setEnabled(boolean b)
Enable or disable this menu.
|
void |
setEnabledWholeMenu(boolean enable)
Enable or disable this menu and its menu items.
|
void |
setModal(boolean isModal)
Enables or disables all default and application menu items or their
assigned actions.
|
void |
setRemoveConsecutiveSeparators(boolean remove)
If set to
true, consecutive separators are reduced to one |
void |
setVisible(boolean b)
Show or hide this menu.
|
add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUIactionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setUIaddActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPositionaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateadd, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprocessKeyEvent, processMouseEventpublic static final int CUSTOM_MENU
public static final int FILE_MENU
public static final int EDIT_MENU
public static final int VIEW_MENU
public static final int WINDOW_MENU
public static final int HELP_MENU
public G9Menu(String title, int menuType, String name)
G9Menu with the supplied title and
name.title - the text for the menu titlemenuType - the menu typename - the name of the menupublic G9Menu(String title, int menuType)
JMenu with the supplied string as its
title.title - the text for the menu titlemenuType - the menu typepublic G9Menu(String s, boolean b, int menuType)
JMenu with the supplied string as its text
and specified as a tear-off menu or not.s - the text for the menu labelb - can the menu be torn off (not yet implemented)menuType - the menu typepublic G9Menu(Action a, int menuType)
JMenu whose properties are taken from the
Action supplied.a - ActionmenuType - the menu typepublic int getMenuType()
public JMenuItem addG9Item(String title)
title - the title of the menu itempublic JMenuItem addG9Item(String title, String name)
title - the title of the menu itemname - the programatic name of the menupublic JMenuItem addG9Item(JMenuItem item)
item - the menu item to addpublic Component addG9Item(JSeparator separator)
separator - the separator to addpublic Component[] getG9Components()
public boolean mergeMenu(G9Menu menu)
Pleas note that the specified menu will lose it's comonents while it is merged with this menu. When another menu is merged, the previously merged menu regains it's components. This is due to the fact that menu items can only belong to one menu - thus merging two menues involves moving menu items from one menu to another.
menu - the menu to merge with this menu.true if the merge where ok, otherwise
falsepublic void setEnabledWholeMenu(boolean enable)
enable - if true the menu are enabled, otherwise
disabled.public void setModal(boolean isModal)
isModal - If true then all default and application menu
items are disabled, otherwise they are enabled.public boolean isModal()
true if this menu is modal otherwise
false.true if this menu is modal otherwise
false.public void setRemoveConsecutiveSeparators(boolean remove)
true, consecutive separators are reduced to oneremove - The flag to set.public boolean isRemoveConsecutiveSeparators()
protected void createMenuComponents()
public Component add(Component c)
setRemoveConsecutiveSeparators(boolean) is set.
Returns the component added or null if separator where
removed as a result of preventing consecutive separators.public void setEnabled(boolean b)
setEnabled in class JMenuItemb - if true enable the menu item.JMenuItem.setEnabled(boolean)public void setVisible(boolean b)
setVisible in class JComponentb - if true the item is made visibleJComponent.setVisible(boolean)protected G9DialogFrame getParentFrame()
null if the menu
bar do not have a parent menu bar.protected void setDefaultItem(List<?> defaultItems)
defaultItems - the menu item to addprotected static G9MenuItem createMenuItem(Action action, String accelerator, String title)
action - the menu item actionaccelerator - the menu item acceleratortitle - the menu item titleCopyright © 2006–2017 Esito AS. All rights reserved.