Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIColumnHeader

public class UIColumnHeader extends UIScrollThumb
{
  // Constructors
  public UIColumnHeader();
  public UIColumnHeader(String text);
  public UIColumnHeader(IUIComponent comp);

  // Methods
  public int getRoleCode();
  public boolean isMoving();
  public boolean isSizing();
  public boolean isSizingLeft();
  public boolean isSizingRight();
  public boolean mouseDown(Event e, int x, int y);
}

This class manages column headers. UIColumnHeader objects are used with UIColumnViewer objects and UIScrollViewer objects to display sizeable headings for columns of data.

You can construct a UIColumnHeader with textual or graphical content using a String or a component (such as a UIText or UIGraphic object). The following example demonstrates different ways to construct a UIColumnHeader object.

// Construct a UIColumnHeader object that displays 
// the "Expenses" text string. By default, the
// text is left-aligned and hot-tracked. 
UIColumnHeader ch1 = new UIColumnHeader("Expenses");

// Construct a UIColumnHeader object that displays 
// the "Revenue" string, centered in the control.
UIColumnHeader ch2 = 
   new UIColumnHeader(new UIText("Revenue", UIStatic.CENTERED));

// Construct a UIColumnHeader object that uses an 
// appropriate, right-aligned .gif file image (for example,
// a "$" sign for "Profit").
URL docBase  = getDocumentBase();
Image myDollarSign = getImage(docBase, "Profit.gif");
UIColumnHeader ch3 = 
   new UIColumnHeader(new UIGraphic(myDollarSign, UIStatic.RIGHT));

When you use a UIGraphic object or an image in a UIColumnHeader, the header is sized to fit the image.

// Create an array of UIColumnHeader objects
// to pass to a UIColumnViewer object.
UIColumnHeader financialReportHeadings [] = {ch1, ch2, ch3};

// Create the UIColumnViewer object that uses 
// the headings. 
UIColumnViewer cv1 = 
   new UIColumnViewer(financialReportHeadings, listOfData);

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
        |
        +--UIThumb
          |
          +--UIScrollThumb
            |
            +--UIColumnHeader

Constructors

UIColumnHeader

public UIColumnHeader();

Creates a column header object with no content.

UIColumnHeader

public UIColumnHeader(String text);

Creates a column header object using the given string for content.

ParameterDescription
text The string to use as the column header.

UIColumnHeader

public UIColumnHeader(IUIComponent comp);

Creates a column header object using the given component for content.

ParameterDescription
comp The component to use.

Methods

getRoleCode

public int getRoleCode();

Retrieves the ROLE_SYSTEM code that best describes the role of the column header control.

Return Value:

Returns the ROLE_SYSTEM_COLUMNHEADER code.

isMoving

public boolean isMoving();

Checks if the column header is moving.

Return Value:

Returns true if the column header is moving; otherwise, returns false.

Remarks:

Column header objects need not remain in the same order they were added to the viewer, and can be moved (along with the column of contents they head) within the viewer object with a drag-and-drop mouse action.

isSizing

public boolean isSizing();

Checks if the column header is sizing left or right.

Return Value:

Returns true if the column header is sizing; otherwise, returns false.

isSizingLeft

public boolean isSizingLeft();

Checks if the left side of the column header is sizing.

Return Value:

Returns true if the left side is sizing; otherwise, returns false.

isSizingRight

public boolean isSizingRight();

Checks if the right side of the column header is sizing.

Return Value:

Returns true if the right side is sizing; otherwise, returns false.

mouseDown

public boolean mouseDown(Event e, int x, int y);

Checks if the mouse button is down. This method specifically checks to see if an edge of the column header is being dragged (a resizing operation) or if the entire header is being moved.

Return Value:

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

ParameterDescription
e The event posted to the control.
x The x coordinate of the event.
y The y coordinate of the event.

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