public class JMenu extends JMenuItem
_actionListeners, _itemListeners
_border
_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
JMenu()
Constructs a new JMenu with no text
(the text can be set later with the setText() method of the
superclass).
|
JMenu(java.lang.String text_)
Constructs a new JMenu with the specified string as its text
|
JMenu(java.lang.String text_,
int mnemonic_)
Constructs a new JMenu with the specified text and the
specified mnemonic character (which must appear in the
text).
|
Modifier and Type | Method and Description |
---|---|
JMenuItem |
add(JMenuItem item_)
Add a JMenuItem (or JMenu) to the end of this JMenu.
|
JMenuItem |
add(java.lang.String text_)
Create a JMenuItem with the specified label and add it to the
menu.
|
void |
addSeparator()
Add a horizontal separator to the end of the menu.
|
void |
debug(int level_)
Output a text description of the menu.
|
void |
draw()
Draws the border of the component (if there is one).
|
void |
fireActionPerformed(ActionEvent ae_)
Invoke all the ActionListener callbacks that may have been registered
for this button.
|
int |
getHeight() |
JMenuItem |
getMenuItem(int index_)
Returns the menu item at the specified index.
|
JPopupMenu |
getPopupMenu()
Returns a reference to this JMenu's popup menu.
|
Dimension |
getSize() |
int |
getWidth() |
boolean |
isPopupMenuVisible()
Returns true if the popup window of this menu is displayed.
|
boolean |
isTopLevelMenu()
Returns true if this menu is the direct child of a menubar.
|
Dimension |
minimumSize() |
void |
setBackground(Color color_)
Sets the background color of this JMenu and all its
contained JMenuItems that do not yet have their background
color set.
|
void |
setForeground(Color color_)
Sets the foreground color of this JMenu and all its
contained JMenuItems that do not yet have their foreground
color set.
|
void |
setPopupMenuVisible(boolean visible_)
Displays this menu's popup menu if the specified value is true;
hides the menu if it is false.
|
java.lang.String |
toString() |
requestFocus
addActionListener, addItemListener, addKeyListenerToAncestor, doClick, fireItemStateChanged, getActionCommand, getLabel, getLabelString, getMnemonic, getText, isSelected, keyPressed, keyReleased, keyTyped, processEvent, processMouseEvent, removeItemListener, setActionCommand, setLabel, setMnemonic, setParent, setSelected, setText
getBorder, getInsets, setBorder
addFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isRecursivelyVisible, isTotallyObscured, isValid, isVisible, processFocusEvent, processKeyEvent, repaint, requestSync, setBounds, setBounds, setBounds, setEnabled, setLocation, setLocation, setName, setVisible, show, validate, validateCursesColor
public JMenu()
public JMenu(java.lang.String text_)
public JMenu(java.lang.String text_, int mnemonic_)
public JMenuItem add(JMenuItem item_)
public void addSeparator()
public JMenuItem add(java.lang.String text_)
public void setForeground(Color color_)
setForeground
in class Component
public void setBackground(Color color_)
setBackground
in class Component
public void draw()
JComponent
public JMenuItem getMenuItem(int index_)
public void fireActionPerformed(ActionEvent ae_)
AbstractButton
fireActionPerformed
in class AbstractButton
public Dimension minimumSize()
minimumSize
in class JMenuItem
public boolean isPopupMenuVisible()
public void setPopupMenuVisible(boolean visible_)
public boolean isTopLevelMenu()
public JPopupMenu getPopupMenu()
public void debug(int level_)