Component and Control Classes: JSMenuComponent


The suntest.javastar.lib.JSMenuComponent interface is constructed with one or more java.awt.MenuComponent objects, allowing simple tests of its contents. As an interface, you cannot instantiate JSMenuComponent, but you can obtain a JSMenuComponent and JSComponent.menubar() using JS.mlookup().

This section describes JSMenuComponent by:

Class

Syntax

Methods

This section provides two ways to view methods. You can use:

If you are viewing this documentation on-line, you can click on any method name to jump to the full description, syntax, and parameter specification.

Methods by Name

JSMenuComponent methods by name

Method Category Description
action() Send event methods Sends an action event referencing this MenuItem.
deselect() Send event methods Sets the state of a CheckboxMenuItem to false (sends a DESELECTED ItemEvent).
getAll() Query methods Returns all MenuComponents pointed to by this JSMenuComponent.
getUnique() Query methods Returns the MenuComponent pointed to by this JSMenuComponent. This requires that there is exactly one match.
getValidUnique() Query methods Returns the only MenuComponent pointed to by this JSMenuComponent which is capable of receiving events.
isUnique() Query methods Returns true if there is exactly one JSMenuComponent contained by this.
isValidUnique() Query methods Returns true if there is one valid match that can receive events.
item(String) Find methods Returns the MenuItem(s) whose label matches label.
item(int, String) Find methods Returns the specified MenuItem, requiring its label to match label.
menu(String) Find methods Returns the menu(s) whose label matches the String you provide.
menu(int, String) Find methods Returns the specified menu, requiring its label match the String you provide.
mlookup(String) Find methods Find contained Named JSMenuComponents whose name matches the String you provide.
nested(String) Find methods Returns the nested Menu(s) whose label matches the String you provide.
nested(int, String) Find methods Returns the specified nested Menu, requiring its label to match the String you provide.
select() Send event methods Sets the state of a CheckboxMenuItem to true (sends a SELECTED ItemEvent).

Methods by Category

JSMenuComponent methods by category

Category Method Description
Find methods Find methods return menus, JSMenuComponents, and menu items that match the criteria you specify. item(String) Returns the MenuItem(s) whose label matches label.
item(int, String) Returns the specified MenuItem, requiring its label to match label.
menu(String) Returns the menu(s) whose label matches the String you provide.
menu(int, String) Returns the specified menu, requiring its label match the String you provide.
mlookup(String) Find contained Named JSMenuComponents whose name matches the String you provide.
nested(String) Returns the nested Menu(s) whose label matches the String you provide.
nested(int, String) Returns the specified nested Menu, requiring its label to match the String you provide.
Query methods These methods query the state of a JSMenuComponent, receiving either Components pointed to by the JSMenuComponent, or a boolean response. getAll() Returns all MenuComponents pointed to by this JSMenuComponent.
getUnique() Returns the MenuComponent pointed to by this JSMenuComponent. This requires that there is exactly one match.
getValidUnique() Returns the only MenuComponent pointed to by this JSMenuComponent which is capable of receiving events.
isUnique() Returns true if there is exactly one JSMenuComponent contained by this.
isValidUnique() Returns true if there is one valid match that can receive events.
Send event methods These methods send events to GUI components. action() Sends an action event referencing this MenuItem.
deselect() Sets the state of a CheckboxMenuItem to false (sends a DESELECTED ItemEvent).
select() Sets the state of a CheckboxMenuItem to true (sends a SELECTED ItemEvent).

action()

Syntax

Category

Send event method

Description

Sends an action event referencing this MenuItem. Only applicable when the contained MenuComponent is a MenuItem.

deselect()

Syntax

Category

Send event method

Description

Sets the state of a CheckboxMenuItem to false (sends a DESELECTED ItemEvent). Only Applicable when contained MenuComponent is CheckboxMenuItem.

getAll()

Syntax

Category

Query method

Description

Returns all MenuComponents pointed to by this JSMenuComponent.

getUnique()

Syntax

Category

Query method

Description

Returns the MenuComponent pointed to by this JSMenuComponent. This requires that there is exactly one match, and throws an exception if there is not.

getValidUnique()

Syntax

Category

Query method

Description

Returns the only MenuComponent pointed to by this JSMenuComponent which is capable of receiving events. If there is no component capable of receiving, or if more than one component can receive, this method throws an exception.

isUnique()

Syntax

Category

Query method

Description

Returns true if there is exactly one MenuComponent contained by this.

isValidUnique()

Syntax

Category

Query method

Description

Returns true if there is one valid match that can receive events.

item(String)

Syntax

Category

Find method

Description

Returns the MenuItem(s) whose label matches label. Only applicable when contained MenuComponent is Menu. Note that this function will not return nested Menus--see nested(String).

Parameters

item(int, String)

Syntax

Category

Find method

Description

Returns the specified MenuItem, requiring its label to match label. Only applicable when contained MenuComponent is Menu. Note that this function will not return nested Menus; see nested(int, String).

Parameter

menu(String)

Syntax

Category

Find method

Description

Returns the menu(s) whose label match label. Only applicable when contained MenuComponent is MenuBar.

Parameters

menu(int, String)

Syntax

Category

Find method

Description

Returns the specified menu, requiring its label match label. Only applicable when contained MenuComponent is MenuBar.

Parameters

mlookup(String)

Syntax

Category

Find method

Description

Find contained Named MenuComponents whose name matches name.

nested(String)

Syntax

Category

Find method

Description

Returns the nested Menu(s) whose label matches label. Only applicable when contained MenuComponent is Menu.

Parameters

nested(int, String)

Syntax

Category

Find method

Description

Returns the specified nested Menu, requiring its label to match label. Only applicable when contained MenuComponent is Menu.

Parameters

select()

Syntax

Category

Send event method

Description

Sets the state of a CheckboxMenuItem to true (sends a SELECTED ItemEvent). Only applicable when contained MenuComponent is CheckboxMenuItem.




Send feedback to JavaStar-feedback@suntest.com
Copyright © 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303. All rights reserved.