Package java.awt Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class CheckboxMenuItem

Constructors , Methods

public  class  java.awt.CheckboxMenuItem
    extends  java.awt.MenuItem  
{
        // Constructors
    public CheckboxMenuItem(String  label);	

        // Methods
    public void addNotify();	
    public boolean getState();	
    public String paramString();	
    public void setState(boolean  t);	
}

This class represents a check box that can be included in a menu. Clicking on the check box in the menu changes its state from "on" to "off" or from "off" to "on".

The picture of a menu bar shows five menu items. The item labeled Check shows a check box menu item in its "off" state.

When a check box menu item is clicked, the AWT sends an action event to the check box menu item's containing frame. The event's target is the check box menu item, and its object is the string label of the check box.


Constructors


CheckboxMenuItem

public CheckboxMenuItem(String  label) 

Creates a check box with the specified label. The check box is initially set to "off".

ParameterDescription
label a string label for the check box menu item, or null for an unlabeled menu item


Methods


addNotify

public void addNotify() 

This method calls the createCheckboxMenuItem method of the check box's toolkit in order to create a CheckboxMenuItemPeer for this button. This peer allows the application to change the look of a check box menu item without changing its functionality.

Most applications do not call this method directly.

Overrides:

addNotify in class MenuItem .


getState

public boolean getState() 

Determines whether this check box menu item is "on" or "off."

Return Value:

Returns the state of this check box menu item: true indicates "on", false indicates "off".


paramString

public String paramString() 

Returns the parameter string representing the state of this check box menu item. This string is useful for debugging.

Return Value:

Returns the parameter string of this check box menu item.

Overrides:

paramString in class MenuItem .


setState

public void setState(boolean  state) 

Sets this check box menu item to the specifed boolean state: true indicates "on"; false indicates "off".

ParameterDescription
state the boolean state of this check box menu item



Top© 1996 Sun Microsystems, Inc. All rights reserved.