All Packages Class Hierarchy This Package Previous Next Index
Class COM.taligent.widget.MultiColumnListbox
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----COM.taligent.widget.MultiColumnListbox
- public class MultiColumnListbox
- extends Panel
- implements WindowListener, ActionListener, ItemSelectable, FocusListener, KeyListener, MouseListener, AdjustmentListener, CaptionBarListener
A simple multi-column listbox. To use the listbox, create
columns and then add rows of data. By default, the listbox
contains text string values, but you can implement the
Paintable interface and insert special "painted" objects.
You can also insert any AWT Component or custom Component.
Each column has the ability to be resized and sorted using
custom sorting algorithms. To create a sorting function for
a column, extend COM.taligent.util.Sorter to provide the
sorting behavior you want and implement
COM.taligent.util.Comparator to provide a sort comparison.
The listbox passes selection events to all registered
ListboxListener objects. Column selection/resizing events are
passed to all registered CaptionBarListener objects.
- See Also:
- ListboxColumn, Paintable, Sorter
-
background
-
-
bar
-
-
columns
-
-
DEFAULT_BACKGROUND_COLOR
- Default background color (Color.lightGray).
-
DEFAULT_CAPTIONBAR_HEIGHT
- Default caption bar height.
-
DEFAULT_FOREGROUND_COLOR
- Default foreground color (Color.black).
-
DEFAULT_KEY
- Default row key value (null).
-
DEFAULT_ROW_HEIGHT
- Default row height (20).
-
DEFAULT_SELECTION_BACKGROUND
- Default selected background color (Color.gray).
-
DEFAULT_SELECTION_FOREGROUND
- Default selected foreground color (Color.black).
-
DEFAULT_SEPARATOR_COLOR
- Default separator color (Color.black).
-
hsep
-
-
lastselected
-
-
rowheight
-
-
selected
-
-
sepcolor
-
-
serialVersionUID
- Standard ***
private final static boolean REGISTERED = false;
/
-
vsep
-
-
MultiColumnListbox()
- Constructor.
-
actionPerformed(ActionEvent)
-
-
addAdjustmentListener(AdjustmentListener, int)
- Adds a scrollbar adjustment listener.
-
addCaptionBarListener(CaptionBarListener)
- Adds a caption bar event listener.
-
addColumn(String)
- Adds a column to the listbox.
-
addColumns(String[])
- Adds a series of columns to the listbox.
-
addItemListener(ItemListener)
- Adds an item listener.
-
addListboxListener(ListboxListener)
- Adds a listbox event listener.
-
addRow(Object[])
- Add a new row to the multi-column listbox with the default key
value.
-
addRow(Object[], Object)
- Add a new row to the multi-column listbox with a given key.
-
addRows(Object[][])
- Adds a series of rows with the default key value.
-
addRows(Object[][], Object[])
- Adds a series of rows with the specified key values.
-
adjustmentValueChanged(AdjustmentEvent)
- A scrollbar was adjusted.
-
allowsMultipleSelections()
- Returns whether multiple selections are allowed.
Deprecated.
-
autoSizeColumn(int)
- Resizes the specified column to fit the widest element
currently in the column.
-
captionResized(CaptionBarEvent)
- A caption was resized.
-
captionSelected(CaptionBarEvent)
- A caption was selected.
-
clear()
- Removes all the rows from the listbox.
Deprecated.
-
countColumns()
- Returns the number of columns in the listbox.
Deprecated.
-
countRows()
- Returns the number of rows in the listbox.
Deprecated.
-
deleteColumn(int)
- Removes a column from the listbox.
Deprecated.
-
deleteRow(int)
- Removes a row from the listbox.
Deprecated.
-
deselectAllRows()
- Deselects all of the rows.
-
deselectRow(int)
- Deselects a row.
-
deselectRowByKey(Object)
- Deselects the first row with the given key.
-
focusGained(FocusEvent)
- When focus is gained, redraws the listbox
indicating the focus.
-
focusLost(FocusEvent)
- When focus is lost, redraw the list without
focus indicator.
-
getBackgroundImage()
- Returns the current background image or null if none
is set.
-
getCaptionBarBackground()
- Returns the current background color of the caption bar.
-
getCaptionBarBackgroundImage()
- Returns the current background image of the caption bar
or null if none is set.
-
getCaptionBarForeground()
- Returns the current foreground color of the caption bar.
-
getCaptionBarHeight()
- Returns the current caption bar height.
-
getColumn(int)
- Returns the array of values in the column, or null if
column specified is invalid.
-
getColumnCount()
- Returns the number of columns in the listbox.
-
getColumnInfo(int)
- Returns a reference to specified column or null if no
such column index exists.
-
getContinuousDrag()
- Returns whether the columns are resized as the
caption is resized or only at the end of the drag.
-
getIndexByKey(Object)
- Returns the index of the first row that has the specified
key or -1 if no row has that key.
-
getKeys()
- Returns the array of key values, or null if there are
no columns or rows in the list.
-
getMinimumSize()
- Returns the minimum size of this component.
-
getMultipleSelections()
- Returns whether multiple selections are allowed.
-
getName()
- Returns a unique name for this listbox.
-
getPreferredSize()
- Returns the preferred size of the listbox which is
just the minimum size.
-
getRow(int)
- Returns the array of values in the row, or null if
row specified is invalid.
-
getRowByKey(Object)
- Returns an array of row values with the specified key or
null if no row has the specified key.
-
getRowCount()
- Returns the number of rows in the listbox.
-
getRowHeight()
- Returns the current height of the listbox rows.
-
getRowKey(int)
- Returns the key value for the specified row.
-
getSelectedColumnIndex()
- Returns the index of the selected column.
-
getSelectedIndex()
- Returns the index of the first selected row or -1 if
no row is selected.
-
getSelectedIndexes()
- Returns an array of indexes of the selected rows.
-
getSelectedObjects()
- Returns an array of selected row arrays.
-
getSelectedRow()
- Returns the first selected row.
-
getSelectedRows()
- Returns all of the selected rowsas an array of rows.
-
getSelectionBackground()
- Gets the current background color for all selected rows.
-
getSelectionForeground()
- Gets the foreground color for all selected rows.
-
getSeparatorColor()
- Returns the current color of the horizontal and vertical
separators.
-
getUpdate()
- Returns whether update are turned on or off.
-
hideBorder()
- Hides the border around the listbox.
Deprecated.
-
hideHorizontalSeparator()
- Hides a horizontal separator line between each row.
Deprecated.
-
hideVerticalSeparator()
- Hides a vertical separator line between each column.
Deprecated.
-
horizontalScrollAdjustment()
- Readjusts caption bar and list area.
-
horizontalSeparatorShown()
- Returns whether horizontal separator lines are shown between
each listbox row.
Deprecated.
-
insertRow(Object[], int)
- Inserts a row of data into the listbox with the default
key value.
-
insertRow(Object[], Object, int)
- Inserts a row of data into the listbox.
-
insertRows(Object[][], int)
- Inserts the given rows at the specified index with the
default key value.
-
insertRows(Object[][], Object[], int)
- Inserts the given rows at the specified index and the
key values.
-
isCaptionBarVisible()
- Returns whether or not the caption bar is being shown.
-
isFocusTraversable()
- The listbox is always traversable.
-
isHorizontalScrollbarVisible()
- Returns whether the horizontal scrollbar is shown.
-
isHorizontalSeparatorVisible()
- Returns whether horizontal separator lines are shown between
each listbox row.
-
isVerticalScrollbarVisible()
- Returns whether the vertical scrollbar is shown.
-
isVerticalSeparatorVisible()
- Returns whether the vertical separators are being shown.
-
keyPressed(KeyEvent)
- A key was pressed.
-
keyReleased(KeyEvent)
- A key was released.
-
keyTyped(KeyEvent)
- A key was typed.
-
makeRowVisible(int)
- Makes the specified row index visible in the listbox.
-
mouseClicked(MouseEvent)
- A mouse button was clicked.
-
mouseEntered(MouseEvent)
- The mouse cursor entered the component.
-
mouseExited(MouseEvent)
- The mouse cursor exited the component.
-
mousePressed(MouseEvent)
- A mouse button was pressed.
-
mouseReleased(MouseEvent)
- A mouse button was released.
-
paint(Graphics)
- Paints the listbox.
-
paintHook(String, int, int)
- This hook allows descendant classes to change the text of a
specific entry *before* it's printed but without changing the
data stored in the element.
-
removeAdjustmentListener(AdjustmentListener, int)
- Removes a scrollbar adjustment listener.
-
removeAllColumns()
- Removes all of the columns from the listbox.
-
removeAllRows()
- Removes all the rows from the listbox.
-
removeCaptionBarListener(CaptionBarListener)
- Removes a caption bar event listener.
-
removeColumn(int)
- Removes a column from the listbox.
-
removeItemListener(ItemListener)
- Removes an item listener
-
removeListboxListener(ListboxListener)
- Removes a listbox event listener.
-
removeRow(int)
- Removes a row from the listbox.
-
removeRows(int, int)
- Removes a series of rows.
-
repaint()
- Repaint caption bar and list area.
-
replaceColumn(Object[], int)
- Replaces the elements in the given column with the array of
objects specified.
-
replaceRow(Object[], int)
- Replaces all elements of the given row with the text strings
specified.
-
resetHorizontalScrollbar()
- Resets the horizontal scrollbar -- internal to listbox.
-
resetVerticalScrollbar()
- Resets the vertical scrollbar -- internal to listbox.
-
selectAllRows()
- Selects all of the rows.
-
selectColumn(int)
- Selects the specified column.
-
selectRow(int)
- Selects a row.
-
selectRowByKey(Object)
- Selects the first row with the given key.
-
setBackgroundImage(Image)
- Sets the background image for drawing.
-
setBounds(int, int, int, int)
- Reshapes the listbox and all the internal components.
-
setCaptionBarBackground(Color)
- Sets the background color of the caption bar.
-
setCaptionBarBackgroundImage(Image)
- Sets the background image of the caption bar.
-
setCaptionBarForeground(Color)
- Sets the foreground color of the caption bar.
-
setCaptionBarHeight(int)
- Sets the size of the caption bar to the specified height.
-
setCaptionBarVisible(boolean)
- Shows or hides the caption bar.
-
setContinuousDrag(boolean)
- Sets whether the columns are resized as the caption
is resized or only at the end of the drag.
-
setHorizontalScrollbarVisible(boolean)
- Shows or hides the horizontal scrollbar.
-
setHorizontalSeparatorVisible(boolean)
- Shows or hides a horizontal separator line between each row.
-
setLayout(LayoutManager)
- Cannot reset the layout manager of this widget.
-
setMultipleSelections(boolean)
- Sets whether multiple selections are allowed in the listbox.
-
setName(String)
- Sets the name of the component.
-
setRowHeight(int)
- Sets the height of the listbox rows.
-
setRowKey(Object, int)
- Sets the key to the specified row.
-
setSelectionBackground(Color)
- Sets the background color for all selected rows.
-
setSelectionForeground(Color)
- Sets the foreground color for all selected rows.
-
setSeparatorColor(Color)
- Sets the color of the horizontal and vertical separators.
-
setUpdate(boolean)
- Sets whether updates occur.
-
setVerticalScrollbarVisible(boolean)
- Shows or hides the vertical scrollbar.
-
setVerticalSeparatorVisible(boolean)
- Show or hides a vertical separator line between each column.
-
showBorder()
- Shows a border around the listbox.
Deprecated.
-
showHorizontalSeparator()
- Shows a horizontal separator line between each row.
Deprecated.
-
showVerticalSeparator()
- Shows a vertical separator line between each column.
Deprecated.
-
sort()
- Sorts the currently selected column.
-
toString()
- Returns a text representation of this instance of MultiColumnListbox.
-
update(Graphics)
- Don't waste time clearing area; not needed.
-
verticalSeparatorShown()
- Returns whether vertical separator lines are shown between
each listbox columns.
Deprecated.
-
windowActivated(WindowEvent)
-
-
windowClosed(WindowEvent)
-
-
windowClosing(WindowEvent)
-
-
windowDeactivated(WindowEvent)
-
-
windowDeiconified(WindowEvent)
-
-
windowIconified(WindowEvent)
-
-
windowOpened(WindowEvent)
-
serialVersionUID
public static final long serialVersionUID
- Standard ***
private final static boolean REGISTERED = false;
/
DEFAULT_KEY
public static final Object DEFAULT_KEY
- Default row key value (null).
DEFAULT_ROW_HEIGHT
public static final int DEFAULT_ROW_HEIGHT
- Default row height (20).
DEFAULT_CAPTIONBAR_HEIGHT
public static final int DEFAULT_CAPTIONBAR_HEIGHT
- Default caption bar height.
DEFAULT_SELECTION_BACKGROUND
public static final Color DEFAULT_SELECTION_BACKGROUND
- Default selected background color (Color.gray).
DEFAULT_SELECTION_FOREGROUND
public static final Color DEFAULT_SELECTION_FOREGROUND
- Default selected foreground color (Color.black).
DEFAULT_BACKGROUND_COLOR
public static final Color DEFAULT_BACKGROUND_COLOR
- Default background color (Color.lightGray).
DEFAULT_FOREGROUND_COLOR
public static final Color DEFAULT_FOREGROUND_COLOR
- Default foreground color (Color.black).
DEFAULT_SEPARATOR_COLOR
public static final Color DEFAULT_SEPARATOR_COLOR
- Default separator color (Color.black).
bar
protected CaptionBar bar
rowheight
protected int rowheight
columns
protected Vector columns
selected
protected transient BitSet selected
sepcolor
protected Color sepcolor
vsep
protected boolean vsep
hsep
protected boolean hsep
lastselected
protected transient int lastselected
background
protected transient Image background
MultiColumnListbox
public MultiColumnListbox()
- Constructor. Constructs a new MultiColumnListbox ready to be
populated with columns and rows of data.
- See Also:
- addColumn, addRow
setLayout
public void setLayout(LayoutManager manager)
- Cannot reset the layout manager of this widget.
- Overrides:
- setLayout in class Container
getSelectedColumnIndex
public int getSelectedColumnIndex()
- Returns the index of the selected column.
getSelectedObjects
public Object[] getSelectedObjects()
- Returns an array of selected row arrays.
- See Also:
- ItemListener
addItemListener
public void addItemListener(ItemListener listener)
- Adds an item listener. Listeners can be notified of
row selection/deselection events through the Java
ItemListener interface call. Using ListboxListener
is preferred; item listeners are provided for
convenience.
- See Also:
- removeItemListener
removeItemListener
public void removeItemListener(ItemListener listener)
- Removes an item listener
- See Also:
- addItemListener
setSeparatorColor
public void setSeparatorColor(Color color)
- Sets the color of the horizontal and vertical separators.
- Parameters:
- color - The new separator color.
- See Also:
- getSeparatorColor
getSeparatorColor
public Color getSeparatorColor()
- Returns the current color of the horizontal and vertical
separators.
- See Also:
- setSeparatorColor
setUpdate
public void setUpdate(boolean update)
- Sets whether updates occur. When updates are turned
off operations that normally would cause the listbox
to be repainted will not paint. A repaint is called
for you when updates are turned back on.
- Parameters:
- update - False to turn updates off; true to
turn back on.
- See Also:
- getUpdate
getUpdate
public boolean getUpdate()
- Returns whether update are turned on or off.
- See Also:
- setUpdate
setName
public void setName(String name)
- Sets the name of the component.
- Overrides:
- setName in class Component
getName
public String getName()
- Returns a unique name for this listbox.
- Overrides:
- getName in class Component
isFocusTraversable
public boolean isFocusTraversable()
- The listbox is always traversable.
- Overrides:
- isFocusTraversable in class Component
focusGained
public void focusGained(FocusEvent evt)
- When focus is gained, redraws the listbox
indicating the focus. In other words, the last
selected row is drawn with a dotted border.
focusLost
public void focusLost(FocusEvent evt)
- When focus is lost, redraw the list without
focus indicator.
setCaptionBarBackground
public void setCaptionBarBackground(Color color)
- Sets the background color of the caption bar.
getCaptionBarBackground
public Color getCaptionBarBackground()
- Returns the current background color of the caption bar.
setCaptionBarForeground
public void setCaptionBarForeground(Color color)
- Sets the foreground color of the caption bar.
getCaptionBarForeground
public Color getCaptionBarForeground()
- Returns the current foreground color of the caption bar.
autoSizeColumn
public void autoSizeColumn(int index)
- Resizes the specified column to fit the widest element
currently in the column.
- Parameters:
- index - The column to resize
horizontalScrollAdjustment
protected void horizontalScrollAdjustment()
- Readjusts caption bar and list area. Internal use only.
resetVerticalScrollbar
protected void resetVerticalScrollbar()
- Resets the vertical scrollbar -- internal to listbox.
resetHorizontalScrollbar
protected void resetHorizontalScrollbar()
- Resets the horizontal scrollbar -- internal to listbox.
setCaptionBarVisible
public void setCaptionBarVisible(boolean visible)
- Shows or hides the caption bar.
- Parameters:
- visible - True to show, false to hide.
- See Also:
- isCaptionBarVisible
isCaptionBarVisible
public boolean isCaptionBarVisible()
- Returns whether or not the caption bar is being shown.
- See Also:
- setCaptionBarVisible
setCaptionBarHeight
public void setCaptionBarHeight(int height)
- Sets the size of the caption bar to the specified height.
- Parameters:
- height - The new height of the caption bar.
- See Also:
- DEFAULT_CAPTIONBAR_HEIGHT, getCaptionBarHeight
getCaptionBarHeight
public int getCaptionBarHeight()
- Returns the current caption bar height.
- See Also:
- setCaptionBarHeight
setContinuousDrag
public void setContinuousDrag(boolean realtime)
- Sets whether the columns are resized as the caption
is resized or only at the end of the drag.
- Parameters:
- realtime - True if column resized with caption;
false if not.
- See Also:
- getContinuousDrag
getContinuousDrag
public boolean getContinuousDrag()
- Returns whether the columns are resized as the
caption is resized or only at the end of the drag.
- See Also:
- setContinuousDrag
setRowHeight
public void setRowHeight(int height)
- Sets the height of the listbox rows.
- Parameters:
- height - The new height.
- See Also:
- getRowHeight
getRowHeight
public int getRowHeight()
- Returns the current height of the listbox rows.
- See Also:
- setRowHeight
selectColumn
public void selectColumn(int column)
- Selects the specified column.
- Parameters:
- column - The index of the column to select.
- See Also:
- ListboxColumn, addColumn, getColumn, replaceColumn
makeRowVisible
public void makeRowVisible(int row)
- Makes the specified row index visible in the listbox.
countColumns
public int countColumns()
- Note: countColumns() is deprecated.
Use getColumnCount().
- Returns the number of columns in the listbox.
getColumnCount
public int getColumnCount()
- Returns the number of columns in the listbox.
- Returns:
- Number of columns.
- See Also:
- addColumn, getColumnInfo
sort
public void sort()
- Sorts the currently selected column.
- See Also:
- isSortable, setSorter
setMultipleSelections
public void setMultipleSelections(boolean allow)
- Sets whether multiple selections are allowed in the listbox.
- Parameters:
- allow - Set to true if multiple selections are allowed.
- See Also:
- getMultipleSelections, selectRow, deselectRow
allowsMultipleSelections
public boolean allowsMultipleSelections()
- Note: allowsMultipleSelections() is deprecated.
Use getMultipleSelections().
- Returns whether multiple selections are allowed.
getMultipleSelections
public boolean getMultipleSelections()
- Returns whether multiple selections are allowed.
- See Also:
- setMultipleSelections
selectRow
public void selectRow(int row)
- Selects a row.
- Parameters:
- row - Which row to select.
- See Also:
- deselectRow, selectAllRows, selectRowByKey
selectAllRows
public void selectAllRows()
- Selects all of the rows. If this listbox doesn't allow multiple
selections, then no rows are selected.
- See Also:
- deselectAllRows, selectRow, selectRowByKey
selectRowByKey
public void selectRowByKey(Object key)
- Selects the first row with the given key.
- Parameters:
- key - The key to search for.
- See Also:
- deselectRowByKey, selectRow, selectAllRows
deselectRow
public void deselectRow(int row)
- Deselects a row.
- Parameters:
- row - The row to deselect.
- See Also:
- deselectAllRows, deselectRowByKey, selectRow
deselectAllRows
public void deselectAllRows()
- Deselects all of the rows.
- See Also:
- deselectRow, deselectRowByKey, selectAllRows
deselectRowByKey
public void deselectRowByKey(Object key)
- Deselects the first row with the given key.
- Parameters:
- key - The key of the row to deselect.
- See Also:
- deselectRow, deselectAllRows, selectRowByKey
countRows
public int countRows()
- Note: countRows() is deprecated.
Use getRowCount().
- Returns the number of rows in the listbox.
getRowCount
public int getRowCount()
- Returns the number of rows in the listbox.
- See Also:
- getColumnCount
showHorizontalSeparator
public void showHorizontalSeparator()
- Note: showHorizontalSeparator() is deprecated.
Use setHorizontalSeparatorVisible(true).
- Shows a horizontal separator line between each row.
hideHorizontalSeparator
public void hideHorizontalSeparator()
- Note: hideHorizontalSeparator() is deprecated.
Use setHorizontalSeparatorVisible(false).
- Hides a horizontal separator line between each row.
setHorizontalSeparatorVisible
public void setHorizontalSeparatorVisible(boolean visible)
- Shows or hides a horizontal separator line between each row.
- Parameters:
- visible - True to show horizontal separator, false
otherwise.
- See Also:
- isHorizontalSeparatorVisible
horizontalSeparatorShown
public boolean horizontalSeparatorShown()
- Note: horizontalSeparatorShown() is deprecated.
Use isHorizontalSeparatorVisible().
- Returns whether horizontal separator lines are shown between
each listbox row.
isHorizontalSeparatorVisible
public boolean isHorizontalSeparatorVisible()
- Returns whether horizontal separator lines are shown between
each listbox row.
- See Also:
- setHorizontalSeparatorVisible
showVerticalSeparator
public void showVerticalSeparator()
- Note: showVerticalSeparator() is deprecated.
Use setVerticalSeparatorVisible(true).
- Shows a vertical separator line between each column.
hideVerticalSeparator
public void hideVerticalSeparator()
- Note: hideVerticalSeparator() is deprecated.
Use setVerticalSeparatorVisible(false).
- Hides a vertical separator line between each column.
setVerticalSeparatorVisible
public void setVerticalSeparatorVisible(boolean visible)
- Show or hides a vertical separator line between each column.
- Parameters:
- visible - True to show, false to hide.
- See Also:
- isVerticalSeparatorVisible, setHorizontalSeparatorVisible
verticalSeparatorShown
public boolean verticalSeparatorShown()
- Note: verticalSeparatorShown() is deprecated.
Use isVerticalSeparatorVisible().
- Returns whether vertical separator lines are shown between
each listbox columns.
isVerticalSeparatorVisible
public boolean isVerticalSeparatorVisible()
- Returns whether the vertical separators are being shown.
- See Also:
- setVerticalSeparatorVisible
addColumn
public ListboxColumn addColumn(String title)
- Adds a column to the listbox.
- Parameters:
- title - The title of this column.
- Returns:
- Returns a reference to the new column.
- See Also:
- addColumns, replaceColumn, removeColumn, getColumnInfo, ListboxColumn
addColumns
public void addColumns(String captions[])
- Adds a series of columns to the listbox.
- Parameters:
- captions - An array containing the titles of the columns to
be added.
- See Also:
- addColumn
deleteColumn
public void deleteColumn(int index)
- Note: deleteColumn() is deprecated.
Use removeColumn().
- Removes a column from the listbox.
removeColumn
public void removeColumn(int index)
- Removes a column from the listbox.
- Parameters:
- index - The index of the column to remove.
- See Also:
- removeAllColumns, addColumn
removeAllColumns
public void removeAllColumns()
- Removes all of the columns from the listbox.
- See Also:
- removeColumn
getColumnInfo
public ListboxColumn getColumnInfo(int column)
- Returns a reference to specified column or null if no
such column index exists.
- Parameters:
- column - The column to return.
addRow
public void addRow(Object elements[])
- Add a new row to the multi-column listbox with the default key
value.
- Parameters:
- elements - An array of objects to add to the listbox, one for
each column. If there are too few elements, blank
strings are added in their place. If too many
strings are sent in, they are ignored.
- See Also:
- addRow, addRows, insertRow, removeRow, getRow, DEFAULT_KEY
addRow
public void addRow(Object elements[],
Object key)
- Add a new row to the multi-column listbox with a given key. The key
can be used by the programmer to associate hash values to individual
rows of data so that those rows can be retrieved
- Parameters:
- elements - An array of objects to add to the listbox, one for
each column. If there are too few elements, blank
strings are added in their place. If too many
strings are sent in, they are ignored.
- key - The associated key for this row.
- See Also:
- addRow, addRows
addRows
public void addRows(Object rows[][])
- Adds a series of rows with the default key value.
- Parameters:
- rows - An array of row arrays. For example: if you
have two columns ("First" and "Last", respectively)
then you would assign rows = { { "Charlie", "Cleveland" },
{ "Eugene", "Shumulinsky" }, { "Tad", "Kollar" } }; .
- See Also:
- addRow
addRows
public void addRows(Object rows[][],
Object keys[])
- Adds a series of rows with the specified key values.
- Parameters:
- rows - An array of row arrays. For example: if you
have two columns ("First" and "Last", respectively)
then you would assign rows to { { "Charlie", "Cleveland" },
{ "Eugene", "Shumulinsky" }, { "Tad", "Kollar" } } .
- keys - An array of key values. If there fewer keys than rows,
then the row is assigned the default key value. If too
many keys are sent, they extra key values are ignored.
- See Also:
- addRow, getRow, replaceRow, removeRow, DEFAULT_KEY
insertRow
public void insertRow(Object elements[],
int where)
- Inserts a row of data into the listbox with the default
key value.
- Parameters:
- elements - The row of data to insert.
- where - Which row to insert new row before.
- See Also:
- DEFAULT_KEY, insertRows, addRow, getRow, removeRow, replaceRow
insertRow
public void insertRow(Object elements[],
Object key,
int where)
- Inserts a row of data into the listbox.
- Parameters:
- elements - The row of data to insert.
- key - The key for this row of data
- where - Which row to insert new row before.
insertRows
public void insertRows(Object rows[][],
int where)
- Inserts the given rows at the specified index with the
default key value.
- Parameters:
- rows - The rows to insert.
- where - The index where to insert.
- See Also:
- insertRow
insertRows
public void insertRows(Object rows[][],
Object keys[],
int where)
- Inserts the given rows at the specified index and the
key values.
- Parameters:
- rows - The rows to insert.
- keys - The key values for the rows.
- where - The index where to insert.
- See Also:
- insertRow
replaceRow
public void replaceRow(Object elements[],
int row)
- Replaces all elements of the given row with the text strings
specified. If the array of String elements does not contain
the same number of elements for the number of columns in the
listbox, blank Strings are used to replace the old values. If
too many elements are given, the extra elements are ignored.
- Parameters:
- elements - The array of new values.
- row - Which row to modify.
- See Also:
- addRow, getRow, removeRow
replaceColumn
public void replaceColumn(Object elements[],
int col)
- Replaces the elements in the given column with the array of
objects specified. If the array of objects does not contain
the same number of elements for the number of rows in the
listbox, blank strings are used to replace the old values. If
too many elements are given, the extra elements are ignored.
- Parameters:
- elements - The array of new values.
- col - Which column to replace.
- See Also:
- addColumn, addColumns, getRow, removeColumn, ListboxColumn
deleteRow
public void deleteRow(int row)
- Note: deleteRow() is deprecated.
Use removeRow().
- Removes a row from the listbox.
removeRow
public void removeRow(int row)
- Removes a row from the listbox.
- Parameters:
- row - The row to remove.
- See Also:
- removeRows, getRow, addRow, replaceRow
removeRows
public void removeRows(int row,
int num)
- Removes a series of rows.
- Parameters:
- row - The row to start removing from.
- num - The number of rows to remove.
- See Also:
- removeRow
getSelectedIndex
public int getSelectedIndex()
- Returns the index of the first selected row or -1 if
no row is selected.
- See Also:
- selectRow, deselectRow, getSelectedIndexes, getSelectedRow, getSelectedRows
getSelectedIndexes
public int[] getSelectedIndexes()
- Returns an array of indexes of the selected rows. If no
rows were selected, the length of the returned array will
be 0.
- See Also:
- selectRow, deselectRow, getSelectedIndex, getSelectedRow, getSelectedRows
getSelectedRow
public Object[] getSelectedRow()
- Returns the first selected row. If no rows are selected,
the length of the returned array will be 0.
- See Also:
- getSelectedRows, getSelectedIndex, getSelectedIndexes, selectRow
getSelectedRows
public Object[][] getSelectedRows()
- Returns all of the selected rowsas an array of rows.
- See Also:
- getSelectedRow
getColumn
public Object[] getColumn(int column)
- Returns the array of values in the column, or null if
column specified is invalid.
- Parameters:
- column - The column to return.
- See Also:
- addColumn
getRow
public Object[] getRow(int index)
- Returns the array of values in the row, or null if
row specified is invalid.
- Parameters:
- index - The row to return.
- See Also:
- addRow
getKeys
public Object[] getKeys()
- Returns the array of key values, or null if there are
no columns or rows in the list.
- See Also:
- getRowKey, getRowByKey, getIndexByKey
getRowByKey
public Object[] getRowByKey(Object key)
- Returns an array of row values with the specified key or
null if no row has the specified key. If multiple rows
have the same key value, then the first row with the
matching key will be returned.
- Parameters:
- key - The key of the row to return.
- See Also:
- getKeys, getRowKey, getIndexByKey
getIndexByKey
public int getIndexByKey(Object key)
- Returns the index of the first row that has the specified
key or -1 if no row has that key.
- Parameters:
- key - The key of the row index to return.
- See Also:
- getKeys, getRowKey, getRowByKey
setRowKey
public void setRowKey(Object key,
int row)
- Sets the key to the specified row.
- Parameters:
- key - The new key.
- row - The row to modify.
- See Also:
- getKeys, getRowKey, getRowByKey, getIndexByKey
getRowKey
public Object getRowKey(int row)
- Returns the key value for the specified row.
- Parameters:
- row - The row to return the key for.
- See Also:
- setRowKey
clear
public void clear()
- Note: clear() is deprecated.
Use removeAllRows().
- Removes all the rows from the listbox.
removeAllRows
public void removeAllRows()
- Removes all the rows from the listbox.
- See Also:
- addRow, setRowKey
setVerticalScrollbarVisible
public void setVerticalScrollbarVisible(boolean visible)
- Shows or hides the vertical scrollbar.
- Parameters:
- visible - True to show, false to hide.
- See Also:
- isVerticalScrollbarVisible
isVerticalScrollbarVisible
public boolean isVerticalScrollbarVisible()
- Returns whether the vertical scrollbar is shown.
- See Also:
- setVerticalScrollbarVisible
setHorizontalScrollbarVisible
public void setHorizontalScrollbarVisible(boolean visible)
- Shows or hides the horizontal scrollbar.
- Parameters:
- visible - True to show, false to hide.
- See Also:
- isHorizontalScrollbarVisible
isHorizontalScrollbarVisible
public boolean isHorizontalScrollbarVisible()
- Returns whether the horizontal scrollbar is shown.
- See Also:
- setHorizontalScrollbarVisible
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- Reshapes the listbox and all the internal components.
- Parameters:
- x - X coordinate.
- y - Y coordinate.
- w - Width.
- h - Height.
- Overrides:
- setBounds in class Component
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size of the listbox which is
just the minimum size.
- Overrides:
- getPreferredSize in class Container
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size of this component.
- Overrides:
- getMinimumSize in class Container
setSelectionBackground
public void setSelectionBackground(Color color)
- Sets the background color for all selected rows.
- Parameters:
- color - The new selected row background color.
- See Also:
- getSelectionForeground, getSelectionBackground, setSelectionForeground
getSelectionBackground
public Color getSelectionBackground()
- Gets the current background color for all selected rows.
- Returns:
- Returns the selected row background color.
- See Also:
- getSelectionForeground, setSelectionForeground, setSelectionBackground
setSelectionForeground
public void setSelectionForeground(Color color)
- Sets the foreground color for all selected rows.
- Parameters:
- color - The new selected row foreground color.
- See Also:
- getSelectionForeground, getSelectionBackground, setSelectionBackground
getSelectionForeground
public Color getSelectionForeground()
- Gets the foreground color for all selected rows.
- Returns:
- Returns the current selected row foreground color.
- See Also:
- getSelectionBackground, setSelectionForeground, setSelectionBackground
showBorder
public void showBorder()
- Note: showBorder() is deprecated.
- Shows a border around the listbox.
hideBorder
public void hideBorder()
- Note: hideBorder() is deprecated.
- Hides the border around the listbox.
setBackgroundImage
public void setBackgroundImage(Image image)
- Sets the background image for drawing. Because java.awt.Image
is not currently serializable, the background image will not
be serialized when this object is serialized.
- Parameters:
- image - The new background image.
- See Also:
- getBackgroundImage
getBackgroundImage
public Image getBackgroundImage()
- Returns the current background image or null if none
is set.
- See Also:
- setBackgroundImage
setCaptionBarBackgroundImage
public void setCaptionBarBackgroundImage(Image image)
- Sets the background image of the caption bar.
- Parameters:
- image - The new background image.
- See Also:
- getBackgroundImage
getCaptionBarBackgroundImage
public Image getCaptionBarBackgroundImage()
- Returns the current background image of the caption bar
or null if none is set.
- See Also:
- setBackgroundImage
update
public void update(Graphics g)
- Don't waste time clearing area; not needed.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Paints the listbox.
- Overrides:
- paint in class Container
repaint
public void repaint()
- Repaint caption bar and list area.
- Overrides:
- repaint in class Component
keyTyped
public void keyTyped(KeyEvent evt)
- A key was typed.
keyPressed
public void keyPressed(KeyEvent evt)
- A key was pressed.
keyReleased
public void keyReleased(KeyEvent evt)
- A key was released.
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent evt)
- A scrollbar was adjusted.
mouseClicked
public void mouseClicked(MouseEvent evt)
- A mouse button was clicked.
mousePressed
public void mousePressed(MouseEvent evt)
- A mouse button was pressed.
mouseReleased
public void mouseReleased(MouseEvent evt)
- A mouse button was released.
mouseEntered
public void mouseEntered(MouseEvent evt)
- The mouse cursor entered the component.
mouseExited
public void mouseExited(MouseEvent evt)
- The mouse cursor exited the component.
captionSelected
public synchronized void captionSelected(CaptionBarEvent evt)
- A caption was selected.
captionResized
public void captionResized(CaptionBarEvent evt)
- A caption was resized.
addCaptionBarListener
public void addCaptionBarListener(CaptionBarListener listener)
- Adds a caption bar event listener.
- Parameters:
- listener - The listener to add.
- See Also:
- removeCaptionBarListener
removeCaptionBarListener
public void removeCaptionBarListener(CaptionBarListener listener)
- Removes a caption bar event listener.
- Parameters:
- listener - The listener to remove.
- See Also:
- addCaptionBarListener
addListboxListener
public void addListboxListener(ListboxListener listener)
- Adds a listbox event listener.
- Parameters:
- listener - The listener to add.
- See Also:
- removeListboxListener
removeListboxListener
public void removeListboxListener(ListboxListener listener)
- Removes a listbox event listener.
- Parameters:
- listener - The listener to remove.
- See Also:
- addListboxListener
addAdjustmentListener
public void addAdjustmentListener(AdjustmentListener listener,
int scrollbar)
- Adds a scrollbar adjustment listener.
- Parameters:
- listener - The listener to add.
- scrollbar - The orientation of the scrollbar to
listen to (e.g. Scrollbar.VERTICAL).
- See Also:
- removeAdjustmentListener, VERTICAL, HORIZONTAL
removeAdjustmentListener
public void removeAdjustmentListener(AdjustmentListener listener,
int scrollbar)
- Removes a scrollbar adjustment listener.
- Parameters:
- listener - The listener to remove.
- scrollbar - The orientation of the scrollbar.
- See Also:
- addAdjustmentListener, VERTICAL, HORIZONTAL
paintHook
protected String paintHook(String s,
int row,
int col)
- This hook allows descendant classes to change the text of a
specific entry *before* it's printed but without changing the
data stored in the element. To use this hook, derive from
MultiColumnListbox and override paintHook to modify the incoming
string, s, and return a new string modified to provide such
behavior as name shortening, etc.
- Parameters:
- s - The original text string
- row - The row of this element.
- col - The column of this element.
- Returns:
- Returns the modified string that will be drawn. The
base class version of this method simply returns the
incoming string, s.
toString
public String toString()
- Returns a text representation of this instance of MultiColumnListbox.
- Returns:
- Returns string representation of listbox.
- Overrides:
- toString in class Component
actionPerformed
public void actionPerformed(ActionEvent evt)
windowClosing
public void windowClosing(WindowEvent evt)
windowOpened
public void windowOpened(WindowEvent evt)
windowClosed
public void windowClosed(WindowEvent evt)
windowIconified
public void windowIconified(WindowEvent evt)
windowDeiconified
public void windowDeiconified(WindowEvent evt)
windowActivated
public void windowActivated(WindowEvent evt)
windowDeactivated
public void windowDeactivated(WindowEvent evt)
All Packages Class Hierarchy This Package Previous Next Index