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
Events
Class | Listener | Description |
JCActionEvent | addActionListener | Posted when a button's is clicked |
-
actionListeners
- List of JCActionEvent listeners
-
comp
- The component being controlled.
-
data
- The data for this component.
-
resize_col
- The mouse position, or the column currently being resized.
-
resizing
- True if a column is being resized.
-
JCHeader()
- Creates an empty header.
-
JCHeader(JCVector)
- Creates a header with the specified labels.
-
JCHeader(String[])
- Creates a header with the specified labels.
-
JCHeader(String[], Applet, String)
- Creates a header which reads parameters from the applet's HTML file.
-
addActionListener(JCActionListener)
- Adds the specified listener to receive action events from the buttons.
-
addButton(Object)
- Creates a button with the specified value, and adds it to the header.
-
addLabel(Object)
- Creates a label with the specified value, and adds it to the header.
-
addNotify()
- Calculates column widths.
-
calcWidth(int)
- Calculates the width of a column.
-
drawLine(boolean, int)
- Draw temporary dashed line while resizing.
-
getColumnAlignment(int)
- Gets a column's alignment (default: BWTEnum.MIDDLELEFT).
-
getColumnAlignments()
- Gets the column alignments.
-
getColumnLeftMargin(int)
- Gets the column's left margin value (pixels).
-
getColumnPosition(int)
- Gets the physical position of the left boundary of the column.
-
getColumnRightMargin(int)
- Gets the column's right margin value (pixels).
-
getColumnWidth(int)
- Gets the current width of a column, or 0 if the column does not exist.
-
getColumnWidths()
- Gets a list of the column widths.
-
getLabels()
- Gets the labels.
-
getMultiColumnComponent()
- Gets the component controlled by the header.
-
getMultiColumnData()
- Gets the component's JCMultiColumnData instance.
-
getNumColumns()
- Gets the current number of columns.
-
getParameters()
- Reads the parameter values from the HTML page using the component's applet.
-
layout()
- Positions all labels.
-
mouseDown(Event)
- If at a label boundary, starts a resize.
-
mouseDrag(Event)
- If currently resizing a column, redraws the temporary line.
-
mouseExit(Event)
- Changes the cursor to the default.
-
mouseExit(Event, int, int)
- Sets the cursor to the default cursor if not resizing a column.
-
mouseMove(Event)
- Tracks the cursor.
-
mouseUp(Event)
- If currently resizing a column, resizes the component's column.
-
preferredHeight()
- Returns the height of the largest label.
-
preferredWidth()
- Returns the preferred width of all labels, adding the component's
first column's offset.
-
recalc()
- Determines the widths of variable-sized columns and repaints.
-
removeActionListener(JCActionListener)
- Removes the specified listener so it no longer receives
action events from the buttons.
-
setButtons(JCVector)
- Creates a JCButton for each label.
HTML param name/value: "Buttons"/comma-separated list of labels
-
setColumnAlignment(int, int)
- Sets a column's alignment.
-
setColumnAlignments(int[])
- Sets the column's alignments.
HTML param name/value: "ColumnAlignments"/comma-separated list of enums
-
setColumnButtons(JCVector)
- Creates a JCButton for each label.
HTML param name/value: "Buttons"/comma-separated list of labels
-
setColumnLabels(JCVector)
- Creates a JCLabel for each label.
HTML param name/value: "Labels"/comma-separated list of labels
-
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
-
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
-
setColumnWidth(int, int)
- Sets the width of a column.
-
setColumnWidths(int[])
- Sets the list of column widths.
-
setFont(Font)
- Sets the font of the component.
-
setLabels(JCVector)
- Creates a JCLabel for each label.
HTML param name/value: "Labels"/comma-separated list of labels
-
setLayout(LayoutManager)
-
Sets the layout manager for this container.
-
setMultiColumnComponent(JCMultiColumnInterface)
- Sets the component which will be controlled by the header.
-
setNumColumns(int)
- Sets the current number of columns.
-
updateParent()
- Recalculates column widths, and forces the parent to relayout the header.
data
protected JCMultiColumnData data
- The data for this component.
comp
protected JCMultiColumnInterface comp
- The component being controlled.
resize_col
protected int resize_col
- The mouse position, or the column currently being resized.
resizing
protected boolean resizing
- True if a column is being resized.
actionListeners
protected JCVector actionListeners
- List of JCActionEvent listeners
JCHeader
public JCHeader()
- Creates an empty header. No parameters are read from an HTML file.
JCHeader
public JCHeader(String labels[])
- Creates a header with the specified labels.
No parameters are read from an HTML file.
JCHeader
public JCHeader(JCVector labels)
- Creates a header with the specified labels.
No parameters are read from an HTML file.
- See Also:
- setLabels
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
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
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
getMultiColumnComponent
public JCMultiColumnInterface getMultiColumnComponent()
- Gets the component controlled by the header.
- See Also:
- setMultiColumnComponent
setMultiColumnComponent
public void setMultiColumnComponent(JCMultiColumnInterface comp)
- Sets the component which will be controlled by the header.
getLabels
public JCComponent[] getLabels()
- Gets the labels.
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
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
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
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
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
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
updateParent
public void updateParent()
- Recalculates column widths, and forces the parent to relayout the header.
- Overrides:
- updateParent in class JCContainer
addNotify
public void addNotify()
- Calculates column widths.
- Overrides:
- addNotify in class JCContainer
layout
public synchronized void layout()
- Positions all labels.
- Overrides:
- layout in class Container
recalc
public void recalc()
- Determines the widths of variable-sized columns and repaints.
preferredHeight
protected int preferredHeight()
- Returns the height of the largest label.
- Overrides:
- preferredHeight in class JCContainer
preferredWidth
protected int preferredWidth()
- Returns the preferred width of all labels, adding the component's
first column's offset.
- Overrides:
- preferredWidth in class JCContainer
addActionListener
public void addActionListener(JCActionListener l)
- Adds the specified listener to receive action events from the buttons.
- See Also:
- JCActionEvent
removeActionListener
public void removeActionListener(JCActionListener l)
- Removes the specified listener so it no longer receives
action events from the buttons.
- See Also:
- addActionListener
mouseMove
protected boolean mouseMove(Event ev)
- Tracks the cursor.
mouseExit
protected boolean mouseExit(Event ev)
- Changes the cursor to the default.
mouseDown
protected boolean mouseDown(Event ev)
- If at a label boundary, starts a resize.
mouseDrag
protected boolean mouseDrag(Event ev)
- If currently resizing a column, redraws the temporary line.
mouseUp
protected boolean mouseUp(Event ev)
- If currently resizing a column, resizes the component's column.
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
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).
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.
getColumnWidths
public int[] getColumnWidths()
- Gets a list of the column widths.
- See Also:
- setColumnWidths
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.
getColumnWidth
public int getColumnWidth(int col)
- Gets the current width of a column, or 0 if the column does not exist.
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.
getNumColumns
public int getNumColumns()
- Gets the current number of columns.
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
getColumnAlignments
public int[] getColumnAlignments()
- Gets the column alignments.
getColumnAlignment
public int getColumnAlignment(int col)
- Gets a column's alignment (default: BWTEnum.MIDDLELEFT).
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
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
getColumnPosition
public int getColumnPosition(int col)
- Gets the physical position of the left boundary of the column.
getColumnLeftMargin
public int getColumnLeftMargin(int col)
- Gets the column's left margin value (pixels).
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
getColumnRightMargin
public int getColumnRightMargin(int col)
- Gets the column's right margin value (pixels).
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
getMultiColumnData
public JCMultiColumnData getMultiColumnData()
- Gets the component's JCMultiColumnData instance.
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