Class tea.set.MultiList
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.MultiList
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----tea.set.MultiList
- public class MultiList
- extends Panel
MultiList widget is a more sophisticated version of List widget. Each
item of the MultiList widget is a row, which is a list of fields. A
title row can be added to the MultiList widget. The operations supported
by the MultiList widget is very similar to the List widget. Users can
select a row or scroll through the list. A single click on a row selects
the row and generates a LIST_SELECT event. A double click on a row
selects the row and generates an ACTION_EVENT in addition to the
LIST_SELECT event. The display of the scrollbar is automatic. It is
shown only when necessary. An optional image can be attached to a
row. If an image exists, it will be displayed at the lefthand side
of the row.
Known Bug: AWT Scrollbar is highly buggy. It exhibits different
behaviors in different environment (JDK, Netscape, ...) and
different versions (1.01, 1.02, ...). To make
sure all area are always shown, the scrollbar value may appear to
to too large, which will cause excessive scrolling at the end.
-
MultiList(int, int)
- Construct a MultiList widget with ncol fields and each with w
character wide.
-
MultiList(int, int, int)
- Construct a MultiList widget with nrow rows, ncol fields, and each
fields with width of w characters.
-
MultiList(int, int[])
- Construct a MultiList widget with nrow rows, and the same number of
fields as the w[] length.
-
MultiList(int[])
- Construct a MultiList widget with the same number of fields as the
length of w[].
-
addRow(String, String)
- Add a row to the list.
-
addRow(String, String, Image)
- Add a row to the list.
-
addRow(String[])
- Add a row to the list.
-
addRow(String[], Image)
- Add a row to the list.
-
addRow(Vector)
- Add a row to the list.
-
addRow(Vector, Image)
- Add a row to the list.
-
clearRows()
- Remove all rows from the list.
-
clearTitle()
- Remove the title row.
-
countRows()
- Return the total number of rows in the list.
-
getRow(int)
- Return the row value at the specified index.
-
getSelectedRow()
- Return the row number of the selected row.
-
handleEvent(Event)
- A single click on a data row generates a LIST_SELECT event.
-
makeVisible(int)
- Make the specified row visible.
-
removeRow(int)
- Remove the specified row.
-
select(int)
- Select the specified row.
-
setRow(String, String, Image, int)
- Set the specified row to the row supplied.
-
setRow(String, String, int)
- Set the specified row to the row supplied.
-
setRow(String[], Image, int)
- Set the specified row to the row supplied.
-
setRow(String[], int)
- Set the specified row to the row supplied.
-
setRow(Vector, Image, int)
- Set the specified row to the row supplied.
-
setRow(Vector, int)
- Set the specified row to the row supplied.
-
setTitle(String, String)
- Add a title row to the list.
-
setTitle(String[])
- Add a title row to the list.
-
setTitle(Vector)
- Add a title row to the list.
MultiList
public MultiList(int ncol,
int w)
- Construct a MultiList widget with ncol fields and each with w
character wide. The width of the field is only used as a
preferred value, and may change depending on the screen size.
- Parameters:
- ncol - number of columns.
- width - of column in characters.
MultiList
public MultiList(int w[])
- Construct a MultiList widget with the same number of fields as the
length of w[]. The width for each field is taken from w[]. The width
values are used to calculate the preferred size, but may change with
screen size. If the preferred width can't be met, the width in the
w[] will be used to distribute space proportional to the values
specified for each field.
- Parameters:
- width - array of columns.
MultiList
public MultiList(int nrow,
int ncol,
int w)
- Construct a MultiList widget with nrow rows, ncol fields, and each
fields with width of w characters. All values specified are advisory
and may change depending on the assigned size for this widget.
- Parameters:
- nrow - number of visible rows.
- ncol - number of columns.
- width - of column in characters.
MultiList
public MultiList(int nrow,
int w[])
- Construct a MultiList widget with nrow rows, and the same number of
fields as the w[] length. The width for each field is specified in
w[] array.
- Parameters:
- nrow - number of visible rows.
- w - column width array.
addRow
public void addRow(Vector row)
- Add a row to the list. Row is a vector of Strings. If the number of
strings in the vector is less than the number of field of this list,
the vector will be padded with empty strings.
- Parameters:
- row - a vector with each item corresponds to a column in the
row.
addRow
public void addRow(String row[])
- Add a row to the list. Row is an array of Strings. If the number of
strings in the array is less than the number of field of this list,
the array will be padded with empty strings.
- Parameters:
- row - an array with each item corresponds to a column in the
row.
addRow
public void addRow(String str,
String delim)
- Add a row to the list. The fields will be parsed from the string with
delim as the delimiter. If the number of fields in the string is
less than the number of fields of this list, the remaining fields
will be set to empty strings.
- Parameters:
- str - column list in delimited form.
- delim - delimiter.
addRow
public void addRow(Vector row,
Image img)
- Add a row to the list. Row is a vector of Strings. If the number of
strings in the vector is less than the number of field of this list,
the vector will be padded with empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- row - a vector with each item corresponds to a column in the
row.
- img - image icon for the row.
addRow
public void addRow(String row[],
Image img)
- Add a row to the list. Row is an array of Strings. If the number of
strings in the array is less than the number of field of this list,
the array will be padded with empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- row - an array with each item corresponds to a column in the
row.
- img - image icon for the row.
addRow
public void addRow(String str,
String delim,
Image img)
- Add a row to the list. The fields will be parsed from the string with
delim as the delimiter. If the number of fields in the string is
less than the number of fields of this list, the remaining fields
will be set to empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- str - column list in delimited form.
- delim - delimiter.
- img - image icon for the row.
setRow
public void setRow(Vector row,
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
Row is a vector of Strings. If the number of
strings in the vector is less than the number of field of this list,
the vector will be padded with empty strings.
- Parameters:
- row - a vector with each item corresponds to a column in the
row.
- pos - row number.
setRow
public void setRow(String row[],
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
Row is an array of Strings. If the number of
strings in the array is less than the number of field of this list,
the array will be padded with empty strings.
- Parameters:
- row - an array with each item corresponds to a column in the
row.
- pos - row number.
setRow
public void setRow(String str,
String delim,
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
The fields will be parsed from the string with
delim as the delimiter. If the number of fields in the string is
less than the number of fields of this list, the remaining fields
will be set to empty strings.
- Parameters:
- str - column list in delimited form.
- delim - delimiter.
- pos - row number.
setRow
public void setRow(Vector row,
Image img,
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
Row is a vector of Strings. If the number of
strings in the vector is less than the number of field of this list,
the vector will be padded with empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- row - a vector with each item corresponds to a column in the
row.
- img - image icon for the row.
- pos - row number.
setRow
public void setRow(String row[],
Image img,
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
Row is an array of Strings. If the number of
strings in the array is less than the number of field of this list,
the array will be padded with empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- row - an array with each item corresponds to a column in the
row.
- img - image icon for the row.
- pos - row number.
setRow
public void setRow(String str,
String delim,
Image img,
int pos)
- Set the specified row to the row supplied. If the position is out of
range, this call is ignored.
The fields will be parsed from the string with
delim as the delimiter. If the number of fields in the string is
less than the number of fields of this list, the remaining fields
will be set to empty strings.
An image can be supplied to be displayed at the left side of the row.
- Parameters:
- str - column list in delimited form.
- delim - delimiter.
- img - image icon for the row.
- pos - row number.
clearTitle
public void clearTitle()
- Remove the title row.
removeRow
public void removeRow(int pos)
- Remove the specified row.
- Parameters:
- pos - row number.
clearRows
public void clearRows()
- Remove all rows from the list. This function will reset all
parameters to the initial state.
setTitle
public void setTitle(Vector row)
- Add a title row to the list. Parameter is same as addRow().
- Parameters:
- row - a vector with each item corresponds to a column in the
row.
setTitle
public void setTitle(String row[])
- Add a title row to the list. Parameter is same as addRow().
- Parameters:
- row - an array with each item corresponds to a column in the
row.
setTitle
public void setTitle(String str,
String delim)
- Add a title row to the list. Parameter is same as addRow().
- Parameters:
- str - column list in delimited form.
- delim - delimiter.
getSelectedRow
public int getSelectedRow()
- Return the row number of the selected row.
- Parameters:
- return - row number of the selected row.
select
public void select(int row)
- Select the specified row.
- Parameters:
- row - row number.
countRows
public int countRows()
- Return the total number of rows in the list.
- Returns:
- number of rows.
getRow
public String[] getRow(int idx)
- Return the row value at the specified index.
- Parameters:
- idx - row number.
- Returns:
- a row which is an array of columns.
makeVisible
public void makeVisible(int row)
- Make the specified row visible.
- Parameters:
- row - row number.
handleEvent
public boolean handleEvent(Event e)
- A single click on a data row generates a LIST_SELECT event. A
double click on a data row generates an ACTION_EVENT. The
arg is set to this MultiList for both events.
- Parameters:
- e - event object.
- Overrides:
- handleEvent in class Component
All Packages Class Hierarchy This Package Previous Next Index