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

Class UITabList

Constructors , Methods

public class UITabList extends UISelector 
{
  // Constructors
  public UITabList();

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

  public Insets insets();
  public void paint(Graphics g);

  public boolean handleEvent(Event e);

}

A class that implements a tab list control; each tab in the list is a UITab object. You'll typically use UITabViewer, rather than direclty using UITabList or UITab. UITabViewer uses UITabList internally to create a list of tabs and their associated pages.

UITabList extends UISelector.


Constructors


UITabList

public UITabList();

Creates an empty tab list control.

Remarks:

Call the add method to add tabs to the list. By default, the control allows only one tab to be selected at a time.


Methods


add

public Component add(String s);

Adds a new tab containing the specified text to the end of the tab list control.

Return Value:

Returns the UITab object that was added.

ParameterDescription
s The text to be displayed on the tab being added.

Remarks:

By default, the text is left-aligned and hot-tracked. To display text that is not hot-tracked, pass a UIText object instead of a String, as shown in the following example.

UITabList t = new UITabList();
t.add(new UIText("Text not hot-tracked"));

add

public Component add(String s, int pos);

Adds a new tab containing the specified text to the tab list control. The tab is added at the specified position.

Return Value:

Returns the UITab object that was added.

ParameterDescription
s The text to be displayed on the tab being added.
pos The indexed position at which to add the tab. 0 identifies the first position; -1 identifies the end of the tab list.

Remarks:

By default, the text is left-aligned and hot-tracked. To display text that is not hot-tracked, pass a UIText object instead of a String, as shown in the following example.

UITabList t = new UITabList()
t.add(new UIText("Text not hot-tracked"), 0);

add

public Component add(Component comp);

Adds a tab to the end of the tab list control.

Return Value:

Returns the UITab object that was added.

ParameterDescription
comp The component to be displayed on the tab being added. If comp is already a tab object, then this tab is added. Otherwise, a new tab is created.

Remarks:

Typically, you'll pass a UIText, UIGraphic, or UIText object for the component. Note that by default, the component is not hot-tracked. To add this support, include the UIStatic.HOTTRACK flag, as shown in the following example.

UITabList t = new UITabList();
t.add(new UIText("Hot-tracked text", UIStatic.HOTTRACK));

add

public Component add(Component comp, int pos);

Adds a tab to the tab list control at the specified position.

Return Value:

Returns the UITab object that was added.

ParameterDescription
comp The component to be displayed on the tab being added. If comp is already a tab object, then this tab is added. Otherwise, a new tab is created.
pos The indexed position at which to add the tab. 0 identifies the first position; -1 identifies the end of the tab list.

Remarks:

Typically, you'll pass a UIText, UIGraphic, or UIText object for the component. Note that by default, the component is not hot-tracked. To add this support, include the UIStatic.HOTTRACK flag, as shown in the following example.

UITabList t = new UITabList();
t.add(new UIText("Hot-tracked text", UIStatic.HOTTRACK), 0);

handleEvent

public boolean handleEvent(Event e);

Determines if a tab in the list has been selected, and, if so, lays out the tab list control.

Return Value:

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

ParameterDescription
e The event.


insets

public Insets insets();

Determines the tab list control's insets (in pixels), which indicate the size of the control's border.

Return Value:

Returns an Insets object containing the tab list control's insets.

Remarks:

This method defines the top and bottom insets to be 2 pixels, and the left and right insets to be 0 pixels.


paint

public void paint(Graphics g);

Draws the tab list control.

Return Value:

No return value.

ParameterDescription
g The graphics context.



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