|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JMenuItem
javax.swing.JCheckBoxMenuItem
public class JCheckBoxMenuItem
A menu item that displays a checkbox. Its behaviour is very similar to
JCheckBox
. Just like the JCheckBox
, user can check
and uncheck this menu item by clicking on it. Also
AbstractButton.setSelected(boolean)
and setState(boolean)
can be use used for
the same purpose. JCheckBoxMenuItem
uses
ToggleButtonModel
to keep track of its selection.
Nested Class Summary | |
---|---|
protected class |
JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem
Provides the accessibility features for the JCheckBoxMenuItem
component. |
Nested classes/interfaces inherited from class javax.swing.JMenuItem |
---|
JMenuItem.AccessibleJMenuItem |
Nested classes/interfaces inherited from class javax.swing.AbstractButton |
---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JCheckBoxMenuItem()
Creates a new JCheckBoxMenuItem object. |
|
JCheckBoxMenuItem(Action action)
Creates a new JCheckBoxMenuItem using given action |
|
JCheckBoxMenuItem(Icon icon)
Creates a new JCheckBoxMenuItem with given icon |
|
JCheckBoxMenuItem(String text)
Creates a new JCheckBoxMenuItem with given label |
|
JCheckBoxMenuItem(String text,
boolean state)
Creates a new JCheckBoxMenuItem object using specified label and marked as checked if given 'state' is true. |
|
JCheckBoxMenuItem(String text,
Icon icon)
Creates a new JCheckBoxMenuItem object with given label and icon |
|
JCheckBoxMenuItem(String text,
Icon icon,
boolean state)
Creates a new JCheckBoxMenuItem object with given label, icon, and marked as checked if given 'state' is true. |
Method Summary | |
---|---|
AccessibleContext |
getAccessibleContext()
Returns the object that provides accessibility features for this JCheckBoxMenuItem component. |
Object[] |
getSelectedObjects()
This method returns array containing label of this menu item if it is selected and null otherwise. |
boolean |
getState()
Returns checked state for this check box menu item. |
String |
getUIClassID()
This method returns a name to identify which look and feel class will be the UI delegate for the menuItem. |
protected String |
paramString()
Returns a string describing the attributes for the JCheckBoxMenuItem component, for use in debugging. |
void |
requestFocus()
This method overrides JComponent.requestFocus with an empty implementation, since JCheckBoxMenuItems should not receive focus in general. |
void |
setState(boolean state)
Sets state for this check box menu item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JCheckBoxMenuItem()
public JCheckBoxMenuItem(Icon icon)
icon
- Icon for this menu itempublic JCheckBoxMenuItem(String text)
text
- Label for this menu itempublic JCheckBoxMenuItem(Action action)
action
- Action for this menu item.public JCheckBoxMenuItem(String text, Icon icon)
text
- Label for this menu itemicon
- Icon for this menu itempublic JCheckBoxMenuItem(String text, boolean state)
text
- Label for this menu itemstate
- true
if this item should be in checked state
and false
otherwisepublic JCheckBoxMenuItem(String text, Icon icon, boolean state)
text
- Label for this menu itemicon
- icon for this menu itemstate
- true
if this item should be in checked state
and false otherwiseMethod Detail |
---|
public String getUIClassID()
getUIClassID
in class JMenuItem
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public boolean getState()
public void setState(boolean state)
state
- new state for this menu itempublic Object[] getSelectedObjects()
getSelectedObjects
in interface ItemSelectable
getSelectedObjects
in class AbstractButton
public void requestFocus()
requestFocus
in class JComponent
Component.AccessibleAWTComponent.requestFocus()
protected String paramString()
JCheckBoxMenuItem
component, for use in debugging. The
return value is guaranteed to be non-null
, but the format
of the string may vary between implementations.
paramString
in class JMenuItem
JCheckBoxMenuItem
.public AccessibleContext getAccessibleContext()
JCheckBoxMenuItem
component.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JMenuItem
JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem
).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |