charvax.swing
Class JMenu

java.lang.Object
  extended bycharva.awt.Component
      extended bycharvax.swing.JComponent
          extended bycharvax.swing.AbstractButton
              extended bycharvax.swing.JMenuItem
                  extended bycharvax.swing.JMenu
All Implemented Interfaces:
EventListener, ItemSelectable, KeyListener

public class JMenu
extends JMenuItem

Implements a menu containing JMenuItems and JSeparators.


Field Summary
 
Fields inherited from class charvax.swing.JMenuItem
_size
 
Fields inherited from class charvax.swing.AbstractButton
_actionListeners, _itemListeners
 
Fields inherited from class charvax.swing.JComponent
_border
 
Fields inherited from class charva.awt.Component
_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
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).
 
Method Summary
 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()
           
 
Methods inherited from class charvax.swing.JMenuItem
requestFocus
 
Methods inherited from class charvax.swing.AbstractButton
addActionListener, addItemListener, doClick, fireItemStateChanged, getActionCommand, getLabel, getLabelString, getMnemonic, getText, isSelected, keyPressed, keyReleased, keyTyped, processEvent, processMouseEvent, removeItemListener, setActionCommand, setLabel, setMnemonic, setSelected, setText
 
Methods inherited from class charvax.swing.JComponent
getBorder, getInsets, setBorder
 
Methods inherited from class charva.awt.Component
addFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isTotallyObscured, isValid, isVisible, processFocusEvent, processKeyEvent, repaint, requestSync, setBounds, setBounds, setBounds, setEnabled, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JMenu

public JMenu()
Constructs a new JMenu with no text (the text can be set later with the setText() method of the superclass).


JMenu

public JMenu(java.lang.String text_)
Constructs a new JMenu with the specified string as its text


JMenu

public 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).

Method Detail

add

public JMenuItem add(JMenuItem item_)
Add a JMenuItem (or JMenu) to the end of this JMenu.

Returns:
the JMenuItem that was added.

addSeparator

public void addSeparator()
Add a horizontal separator to the end of the menu.


add

public JMenuItem add(java.lang.String text_)
Create a JMenuItem with the specified label and add it to the menu.

Returns:
a reference to the newly created JMenuItem.

setForeground

public 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. Overrides the same method in the Component class.

Overrides:
setForeground in class Component

setBackground

public 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. Overrides the same method in the Component class.

Overrides:
setBackground in class Component

draw

public void draw()
Description copied from class: JComponent
Draws the border of the component (if there is one).

Overrides:
draw in class JMenuItem

getMenuItem

public JMenuItem getMenuItem(int index_)
Returns the menu item at the specified index. If the object at the specified index is a JSeparator, it returns null.


fireActionPerformed

public void fireActionPerformed(ActionEvent ae_)
Description copied from class: AbstractButton
Invoke all the ActionListener callbacks that may have been registered for this button.

Overrides:
fireActionPerformed in class AbstractButton

minimumSize

public Dimension minimumSize()
Overrides:
minimumSize in class JMenuItem

getSize

public Dimension getSize()
Overrides:
getSize in class JMenuItem

getWidth

public int getWidth()
Overrides:
getWidth in class JMenuItem

getHeight

public int getHeight()
Overrides:
getHeight in class JMenuItem

isPopupMenuVisible

public boolean isPopupMenuVisible()
Returns true if the popup window of this menu is displayed.


setPopupMenuVisible

public void setPopupMenuVisible(boolean visible_)
Displays this menu's popup menu if the specified value is true; hides the menu if it is false.


isTopLevelMenu

public boolean isTopLevelMenu()
Returns true if this menu is the direct child of a menubar.


getPopupMenu

public JPopupMenu getPopupMenu()
Returns a reference to this JMenu's popup menu.


debug

public void debug(int level_)
Output a text description of the menu.

Overrides:
debug in class JMenuItem

toString

public java.lang.String toString()
Overrides:
toString in class JMenuItem