Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class UIRadioTree

Constructors , Methods

public class UIRadioTree extends UITree
{
  // Constructors
  public UIRadioTree();
  public UIRadioTree(String s);
  public UIRadioTree(Image i, String s);
  public UIRadioTree(Component comp);
  public UIRadioTree(Component comp, int indent);

  // Methods
  public Component add(String s, int pos);
  public Component add(Image i, String s, int pos);

  public boolean action(Event e, Object o);
  public void setSelectedItem(Component comp);

}

A class that implements a radio selection tree control. Each child item you add to a UIRadioTree object automatically becomes a radio button under that tree node. Note that the UIRadioTree node itself does not appear as a radio button. Use UIRadioButton to manually add a radio button image to the node, as shown in the following example.

// Construct a radio tree node with the
// radio button image.
UIRadioTree r = new UIRadioTree(new UIRadioButton("Radio Tree"));

For more information about using tree controls, see the UITree overview.


Constructors


UIRadioTree

public UIRadioTree();

Creates a new tree node with no content.

Remarks:

Call the add method to add items to the tree node list.


UIRadioTree

public UIRadioTree(String s);

Creates a new tree node using the specified text for content.

ParameterDescription
s The text to be displayed with the node.

Remarks:

Call the add method to add items to the tree node list.


UIRadioTree

public UIRadioTree(Image i, String s);

Creates a new tree node using the specified image and text for content.

ParameterDescription
i The image to be displayed with the node.
s The text to be displayed with the node.

Remarks:

Call the add method to add items to the tree node list.


UIRadioTree

public UIRadioTree(Component comp);

Creates a new tree node using the specified component for content.

ParameterDescription
comp The component to be displayed with the node.

Remarks:

Call the add method to add items to the tree node list.


UIRadioTree

public UIRadioTree(Component comp, int indent);

Creates a new tree node using the specified component for content and the specified indent.

ParameterDescription
comp The component to be displayed with the node.
indent The indent (in pixels) to be used when laying out node children.

Remarks:

Call the add method to add items to the tree node list.


Methods


action

public boolean action(Event e, Object o);

Determines whether the tree node was double-clicked, and, if so, toggles the expanded state.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the tree control.
o The component that was double-clicked.

Remarks:

The mouseDown event method (inherited through UISelector) generates an action event when the tree node is double-clicked. If the node was expanded when double-clicked, this method collapses the node; if the node was collapsed, this method expands the node.


add

public Component add(String s, int pos);

Adds a radio button to the tree node list at the specified position. The radio button displays the specified text.

Return Value:

Returns the radio button component that was added.

ParameterDescription
s The text for the radio button.
pos The indexed position at which to add the radio button. The first position in the list is identified by 0; the end of the list is identified by -1.

Remarks:

The newly-added child component is shown or hidden, according to the tree node's expanded state. To remove the component, call remove (inherited through UITree).


add

public Component add(Image i, String s, int pos);

Adds a radio button to the tree node list at the specified position. The radio button displays the specified image and text.

Return Value:

Returns the radio button component that was added.

ParameterDescription
i The image for the radio button.
s The text for the radio button.
pos The indexed position at which to add the radio button. The first position in the list is identified by 0; the end of the list is identified by -1.

Remarks:

The newly-added child component is shown or hidden, according to the tree node's expanded state. To remove the component, call remove (inherited through UITree).


setSelectedItem

public void setSelectedItem(Component comp);

Sets the selection to the specified component in the radio tree node.

Return Value:

No return value.

ParameterDescription
comp The component item to be selected.

Remarks:

If the specified component item is a radio button, this method sets or clears the button's checked state (as appropriate).



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.