Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UITab

public class UITab extends UISingleContainer
{
  // Constructors
  public UITab();
  public UITab(String s);
  public UITab(IUIComponent comp);

  // Methods
  public Insets getInsets();
  public int getRoleCode();
  public boolean gotFocus(Event e, Object o);
  public void paint(FxGraphics g);
  public void setSelected(boolean on);
}

This class implements a tab control. UITab is used by UITabList to manage a collection of tabs. Typically, you'll use UITabViewer instead of UITab or UITabList. UITabViewer manages a collection of tabs and their associated pages.

Note When a UITab object is created with a String, the tab is automatically hot-tracked. To override this default, construct the tab with a UIText object, as shown in the following example.

UITab t1, t2, t3;

// Construct a tab with a String. By default, the tab
// is hot-tracked and the text is left-aligned.
t1 = new UITab("Hot-tracked text");

// Construct a tab that is not hot-tracked, using a 
// UIText object. By default, the text is centered.
t2 = new UITab(new UIText("Text not hot-tracked"));

// To create a hot-tracked tab using UIText, specify
// the UIStatic.HOTTRACK style. To left-align the text,
// include the UIStatic.LEFT style.
t3 = new UITab(new UIText("Hot-tracked UIText", 
                          UIStatic.HOTTRACK | UIStatic.LEFT));
add(t1);
add(t2);
add(t3);

For more information about hot-tracking, see the UIText overview.

Note The hot-track color is the same color as the button text color. As a result, hot-tracking does not appear to be functional.

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UISingleContainer
        |
        +--UITab

Constructors

UITab

public UITab();

Creates a tab control with no content.

UITab

public UITab(String s);

Creates a tab control with the specified text.

ParameterDescription
s The text to be displayed on the tab.

Remarks:

By default, the tab control is hot-tracked. To create a tab that is not hot-tracked, pass a UIText object instead of a String. For more information about hot-tracking, see the UITab overview.

UITab

public UITab(IUIComponent comp);

Creates a tab control with the specified component.

ParameterDescription
comp The component to be displayed on the tab.

Remarks:

Typically, you'll pass a UIText, a UIGraphic, or a UIItem object for the component. For examples of how to construct tabs,see the UITab overview.

Methods

getInsets

public Insets getInsets();

Retrieves the tab control's insets (in pixels), which identify the nonclient area of the control.

Return Value:

Returns an Insets object containing the control's insets.

Remarks:

If the tab is currently selected, the bottom inset is incremented by 4 pixels.

getRoleCode

public int getRoleCode();

Retrieves the ROLE_SYSTEM code that best describes the role of the tab control.

Return Value:

Returns the ROLE_SYSTEM_PAGETAB code.

gotFocus

public boolean gotFocus(Event e, Object o);

Responds to the control receiving input focus. If the control does not have the focus, ensureVisible is called to bring the control into focus. Calls UIComponent.gotFocus.

Return Value:

Returns true if the object has the focus; otherwise, returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event.

See Also: com.ms.ui.UIContainer.ensureVisible, com.ms.ui.UIComponent.gotFocus

paint

public void paint(FxGraphics g);

Draws the tab control.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

This method draws the tab's top, left, and right edges, with rounded corners.

setSelected

public void setSelected(boolean on);

Sets or clears the selected state of the control.

Return Value:

No return value.

ParameterDescription
on If true, the selected state is set; otherwise, it is cleared.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.