All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCHeader

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----jclass.bwt.JCContainer
                                   |
                                   +----jclass.bwt.JCHeader

public class JCHeader
extends JCContainer
implements JCMultiColumnInterface
A component which displays a row of labels, commonly used to show column labels for a multi-column component. The user can drag the separator between labels to resize a column.

Properties

Name Method
Background setBackground
ColumnAlignments setColumnAlignments
ColumnLeftMargin setColumnLeftMargin
ColumnRightMargin setColumnRightMargin
ColumnWidths setColumnWidths
Font setFont
Foreground setForeground
Insets setInsets
Labels setLabels
Buttons setButtons
NumColumns setNumColumns
PreferredSize setPreferredSize
UserData setUserData

Events

Class Listener Description
JCActionEvent addActionListener Posted when a button's is clicked


Variable Index

 o actionListeners
List of JCActionEvent listeners
 o comp
The component being controlled.
 o data
The data for this component.
 o resize_col
The mouse position, or the column currently being resized.
 o resizing
True if a column is being resized.

Constructor Index

 o JCHeader()
Creates an empty header.
 o JCHeader(JCVector)
Creates a header with the specified labels.
 o JCHeader(String[])
Creates a header with the specified labels.
 o JCHeader(String[], Applet, String)
Creates a header which reads parameters from the applet's HTML file.

Method Index

 o addActionListener(JCActionListener)
Adds the specified listener to receive action events from the buttons.
 o addButton(Object)
Creates a button with the specified value, and adds it to the header.
 o addLabel(Object)
Creates a label with the specified value, and adds it to the header.
 o addNotify()
Calculates column widths.
 o calcWidth(int)
Calculates the width of a column.
 o drawLine(boolean, int)
Draw temporary dashed line while resizing.
 o getColumnAlignment(int)
Gets a column's alignment (default: BWTEnum.MIDDLELEFT).
 o getColumnAlignments()
Gets the column alignments.
 o getColumnLeftMargin(int)
Gets the column's left margin value (pixels).
 o getColumnPosition(int)
Gets the physical position of the left boundary of the column.
 o getColumnRightMargin(int)
Gets the column's right margin value (pixels).
 o getColumnWidth(int)
Gets the current width of a column, or 0 if the column does not exist.
 o getColumnWidths()
Gets a list of the column widths.
 o getLabels()
Gets the labels.
 o getMultiColumnComponent()
Gets the component controlled by the header.
 o getMultiColumnData()
Gets the component's JCMultiColumnData instance.
 o getNumColumns()
Gets the current number of columns.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o layout()
Positions all labels.
 o mouseDown(Event)
If at a label boundary, starts a resize.
 o mouseDrag(Event)
If currently resizing a column, redraws the temporary line.
 o mouseExit(Event)
Changes the cursor to the default.
 o mouseExit(Event, int, int)
Sets the cursor to the default cursor if not resizing a column.
 o mouseMove(Event)
Tracks the cursor.
 o mouseUp(Event)
If currently resizing a column, resizes the component's column.
 o preferredHeight()
Returns the height of the largest label.
 o preferredWidth()
Returns the preferred width of all labels, adding the component's first column's offset.
 o recalc()
Determines the widths of variable-sized columns and repaints.
 o removeActionListener(JCActionListener)
Removes the specified listener so it no longer receives action events from the buttons.
 o setButtons(JCVector)
Creates a JCButton for each label.

HTML param name/value: "Buttons"/comma-separated list of labels

 o setColumnAlignment(int, int)
Sets a column's alignment.
 o setColumnAlignments(int[])
Sets the column's alignments.

HTML param name/value: "ColumnAlignments"/comma-separated list of enums

 o setColumnButtons(JCVector)
Creates a JCButton for each label.

HTML param name/value: "Buttons"/comma-separated list of labels

 o setColumnLabels(JCVector)
Creates a JCLabel for each label.

HTML param name/value: "Labels"/comma-separated list of labels

 o setColumnLeftMargin(int, int)
Sets the column's left margin value (pixels) (default: 5).

HTML param name/value: "ColumnLeftMargins"/comma-separated list of ints, one for each column

 o setColumnRightMargin(int, int)
Sets the column's right margin value (pixels) (default: 5).

HTML param name/value: "ColumnRightMargins"/comma-separated list of ints, one for each column

 o setColumnWidth(int, int)
Sets the width of a column.
 o setColumnWidths(int[])
Sets the list of column widths.
 o setFont(Font)
Sets the font of the component.
 o setLabels(JCVector)
Creates a JCLabel for each label.

HTML param name/value: "Labels"/comma-separated list of labels

 o setLayout(LayoutManager)
Sets the layout manager for this container.
 o setMultiColumnComponent(JCMultiColumnInterface)
Sets the component which will be controlled by the header.
 o setNumColumns(int)
Sets the current number of columns.
 o updateParent()
Recalculates column widths, and forces the parent to relayout the header.

Variables

 o data
 protected JCMultiColumnData data
The data for this component.

 o comp
 protected JCMultiColumnInterface comp
The component being controlled.

 o resize_col
 protected int resize_col
The mouse position, or the column currently being resized.

 o resizing
 protected boolean resizing
True if a column is being resized.

 o actionListeners
 protected JCVector actionListeners
List of JCActionEvent listeners

Constructors

 o JCHeader
 public JCHeader()
Creates an empty header. No parameters are read from an HTML file.

 o JCHeader
 public JCHeader(String labels[])
Creates a header with the specified labels. No parameters are read from an HTML file.

 o JCHeader
 public JCHeader(JCVector labels)
Creates a header with the specified labels. No parameters are read from an HTML file.

See Also:
setLabels
 o JCHeader
 public JCHeader(String labels[],
                 Applet applet,
                 String name)
Creates a header which reads parameters from the applet's HTML file.

Parameters:
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
setLabels

Methods

 o getParameters
 protected void getParameters()
Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

Overrides:
getParameters in class JCContainer
 o setFont
 public synchronized void setFont(Font f)
Sets the font of the component. This value may be set from an HTML file using a PARAM tag with a "Font" name and a Font value.

Overrides:
setFont in class Component
See Also:
toFont
 o getMultiColumnComponent
 public JCMultiColumnInterface getMultiColumnComponent()
Gets the component controlled by the header.

See Also:
setMultiColumnComponent
 o setMultiColumnComponent
 public void setMultiColumnComponent(JCMultiColumnInterface comp)
Sets the component which will be controlled by the header.

 o getLabels
 public JCComponent[] getLabels()
Gets the labels.

 o setColumnLabels
 public void setColumnLabels(JCVector labels)
Creates a JCLabel for each label.

HTML param name/value: "Labels"/comma-separated list of labels

See Also:
addLabel, addButton
 o setLabels
 public void setLabels(JCVector labels)
Creates a JCLabel for each label.

HTML param name/value: "Labels"/comma-separated list of labels

See Also:
addLabel, addButton, toVector
 o setColumnButtons
 public void setColumnButtons(JCVector labels)
Creates a JCButton for each label.

HTML param name/value: "Buttons"/comma-separated list of labels

See Also:
addButton, addButton
 o setButtons
 public void setButtons(JCVector labels)
Creates a JCButton for each label.

HTML param name/value: "Buttons"/comma-separated list of labels

See Also:
addButton, addButton, toVector
 o addLabel
 public JCLabel addLabel(Object label)
Creates a label with the specified value, and adds it to the header.

Returns:
the new label
See Also:
addButton, setLabel
 o addButton
 public JCButton addButton(Object label)
Creates a button with the specified value, and adds it to the header.

Returns:
the new button
See Also:
addButton, setLabel
 o updateParent
 public void updateParent()
Recalculates column widths, and forces the parent to relayout the header.

Overrides:
updateParent in class JCContainer
 o addNotify
 public void addNotify()
Calculates column widths.

Overrides:
addNotify in class JCContainer
 o layout
 public synchronized void layout()
Positions all labels.

Overrides:
layout in class Container
 o recalc
 public void recalc()
Determines the widths of variable-sized columns and repaints.

 o preferredHeight
 protected int preferredHeight()
Returns the height of the largest label.

Overrides:
preferredHeight in class JCContainer
 o preferredWidth
 protected int preferredWidth()
Returns the preferred width of all labels, adding the component's first column's offset.

Overrides:
preferredWidth in class JCContainer
 o addActionListener
 public void addActionListener(JCActionListener l)
Adds the specified listener to receive action events from the buttons.

See Also:
JCActionEvent
 o removeActionListener
 public void removeActionListener(JCActionListener l)
Removes the specified listener so it no longer receives action events from the buttons.

See Also:
addActionListener
 o mouseMove
 protected boolean mouseMove(Event ev)
Tracks the cursor.

 o mouseExit
 protected boolean mouseExit(Event ev)
Changes the cursor to the default.

 o mouseDown
 protected boolean mouseDown(Event ev)
If at a label boundary, starts a resize.

 o mouseDrag
 protected boolean mouseDrag(Event ev)
If currently resizing a column, redraws the temporary line.

 o mouseUp
 protected boolean mouseUp(Event ev)
If currently resizing a column, resizes the component's column.

 o mouseExit
 public boolean mouseExit(Event ev,
                          int x,
                          int y)
Sets the cursor to the default cursor if not resizing a column.

Overrides:
mouseExit in class Component
 o drawLine
 protected void drawLine(boolean clear,
                         int x)
Draw temporary dashed line while resizing.

Parameters:
clear - If true, the previously-drawn line is erased (and the remaining arguments are ignored).
 o calcWidth
 public int calcWidth(int col)
Calculates the width of a column. If the multiColumn component's column width is not VARIABLE, it is returned. Otherwise the larger of the label's width and the component's column width is returned.

 o getColumnWidths
 public int[] getColumnWidths()
Gets a list of the column widths.

See Also:
setColumnWidths
 o setColumnWidths
 public void setColumnWidths(int widths[])
Sets the list of column widths. If a column's value is set to BWTEnum.VARIABLE, the width is set to the widest value in the column.

HTML param name/value: "ColumnWidths" name and a comma-separated list of ints.

 o getColumnWidth
 public int getColumnWidth(int col)
Gets the current width of a column, or 0 if the column does not exist.

 o setColumnWidth
 public void setColumnWidth(int col,
                            int width)
Sets the width of a column. If the value is set to BWTEnum.VARIABLE, the width is set to the widest value in the column.

 o getNumColumns
 public int getNumColumns()
Gets the current number of columns.

 o setNumColumns
 public void setNumColumns(int v)
Sets the current number of columns. If set to BWTEnum.VARIABLE (default), all labels are displayed.

HTML param name/value: "NumColumns"/int

 o getColumnAlignments
 public int[] getColumnAlignments()
Gets the column alignments.

 o getColumnAlignment
 public int getColumnAlignment(int col)
Gets a column's alignment (default: BWTEnum.MIDDLELEFT).

 o setColumnAlignment
 public void setColumnAlignment(int col,
                                int align)
Sets a column's alignment.

Parameters:
alignment - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT
 o setColumnAlignments
 public void setColumnAlignments(int align[])
Sets the column's alignments.

HTML param name/value: "ColumnAlignments"/comma-separated list of enums

Parameters:
align - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT
 o getColumnPosition
 public int getColumnPosition(int col)
Gets the physical position of the left boundary of the column.

 o getColumnLeftMargin
 public int getColumnLeftMargin(int col)
Gets the column's left margin value (pixels).

 o setColumnLeftMargin
 public void setColumnLeftMargin(int col,
                                 int value)
Sets the column's left margin value (pixels) (default: 5).

HTML param name/value: "ColumnLeftMargins"/comma-separated list of ints, one for each column

 o getColumnRightMargin
 public int getColumnRightMargin(int col)
Gets the column's right margin value (pixels).

 o setColumnRightMargin
 public void setColumnRightMargin(int col,
                                  int value)
Sets the column's right margin value (pixels) (default: 5).

HTML param name/value: "ColumnRightMargins"/comma-separated list of ints, one for each column

 o getMultiColumnData
 public JCMultiColumnData getMultiColumnData()
Gets the component's JCMultiColumnData instance.

 o setLayout
 public final void setLayout(LayoutManager mgr)
Sets the layout manager for this container. This method is overridden to prevent the layout mgr from being set.

Overrides:
setLayout in class Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index