Table of Contents Markup Tutorial Interfacing with Java™ Web Services

Buttons are used to trigger actions or to make choices. Depending on your needs, you may choose from any of the four button types, namely, push buttons, toggle buttons, check boxes, and radio buttons.

Push Buttons

Push Buttons are used for triggering actions. Like labels, they support an icon and a title, either or both of which may be specified for a button. Push buttons are represented by the button element type. The following example shows how to describe simple push buttons using button elements.

Make this object in eNode Sandbox. The result should be similar to the following:

The examples presented here describe buttons as they relate to a view. Also see how to attach actions to buttons. The following example shows that an icon for a button can be set the same way it is set for labels.

Make this object in eNode Sandbox. The result should be similar to the following:

A button need not have a title. The following example shows a button with just an icon. Also, note that the example is using Flow Layout, which is the default layout manager for panels.

Make this object in eNode Sandbox. The result should be similar to the following:

Toggle Buttons

A toggle button looks like a push button, but maintains a selected state, which can be toggled by clicking the button. A group of toggle buttons may be set up to exhibit mutually exclusive behavior, but it is also acceptable for toggle buttons not to be grouped in this manner.

A toggle button is represented by the toggleButton element type, and is syntactically very similar to the button element type. The following example shows how to set up toggle buttons inside a panel.

Make this object in eNode Sandbox. The result should be similar to the following:

Check Boxes

A check box is represented by the checkBox element type whose syntax is identical to the toggleButton element type. Like a toggle button, a check box also maintains a selected state, but differs in appearance as shown in the following example. Also, while toggle buttons may be grouped into a collection of mutually exclusive buttons, grouping check boxes in that manner is considered bad user interface design.

Make this object in eNode Sandbox. The result should be similar to the following:

Radio Buttons

A radio button is represented by the radioButton element type whose syntax is identical to the toggleButton element type. Like a toggle button, a radio button also maintains a selected state, but differs in appearance. Also, while toggle buttons may exhibit mutually exclusive behavior, radio buttons are always grouped like that. Mutually exclusive radio buttons and toggle buttons are discussed under Button Group.


Copyright © 2002 eNode, Inc. All Rights Reserved.