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 TableListener, CaptionBarListener, ItemSelectable, MouseListener, KeyListener, AdjustmentListener
The Taligent MultiColumnListbox Bean allows Java programmers to add multi-column listboxes to your applets and applications with relative ease. Columns can be resized by the user and can be sorted using any sorting algorithm you want. In addition, you can set specific colors for each column, and even insert graphical elements anywhere in the listbox. The listbox can even handle Java components added as elements!

The new version provides better operability with existing development environments like IBM's VisualAge for Java and a concise data model while maintaining the same easy to use API! Check it out for yourself and you'll see why this listbox is so popular.

History:

Version:
3.0
Author:
Andy Clark, Taligent Inc.
See Also:
TableModel, CaptionBar, ListboxColumn

Variable Index

 o DEFAULT_BACKGROUND_COLOR
Default background color (Color.lightGray).
 o DEFAULT_CAPTIONBAR_HEIGHT
Default caption bar height (20).
 o DEFAULT_FOREGROUND_COLOR
Default foreground color (Color.black).
 o DEFAULT_KEY
Default row key value (null).
 o DEFAULT_ROW_HEIGHT
Default row height (20).
 o DEFAULT_SELECTION_BACKGROUND
Default selected background color (Color.gray).
 o DEFAULT_SELECTION_FOREGROUND
Default selected foreground color (Color.black).
 o DEFAULT_SEPARATOR_COLOR
Default separator color (Color.black).

Constructor Index

 o MultiColumnListbox()
Default constructor.
 o MultiColumnListbox(TableModel)
Constructs a listbox view with the given table.

Method Index

 o addAdjustmentListener(AdjustmentListener, int)
Adds a scrollbar adjustment listener. Deprecated.
 o addCaptionBarListener(CaptionBarListener)
Adds a caption bar event listener.
 o addColumn(Object)
Adds a column to the listbox.
 o addColumns(Object[])
Adds a series of columns to the listbox.
 o addItemListener(ItemListener)
Adds an item listener.
 o addKeyListener(KeyListener)
Adds a key listener.
 o addListboxListener(ListboxListener)
Adds a listbox event listener.
 o addMouseListener(MouseListener)
Adds a mouse listener.
 o addMouseMotionListener(MouseMotionListener)
Adds a mouse motion listener.
 o addRow(Object[])
Add a new row to the multi-column listbox with the default key value.
 o addRow(Object[], Object)
Add a new row to the multi-column listbox with a given key.
 o addRows(Object[][])
Adds a series of rows with the default key value.
 o addRows(Object[][], Object[])
Adds a series of rows with the specified key values.
 o adjustmentValueChanged(AdjustmentEvent)
Adjustment value changed.
 o allowSelection(ListboxEvent)
This function acts as a mask to allow/disallow selection given a specific row, column, and relative (x,y) within it.
 o autoSizeColumn(int)
Resizes the specified column to fit the widest element currently in the column.
 o captionResized(CaptionBarEvent)
A caption was resized.
 o captionSelected(CaptionBarEvent)
A caption was selected.
 o columnAdded(TableEvent)
A column was added.
 o columnChanged(TableEvent)
Column was changed.
 o columnInfoChanged(TableEvent)
Column information changed.
 o columnInserted(TableEvent)
A column was inserted.
 o columnRemoved(TableEvent)
A column was removed.
 o createCaption()
This function is a "factory" method that creates a listbox caption.
 o deliverEvent(EventObject)
This function delivers listbox related events.
 o deselectAllRows()
Deselects all of the rows.
 o deselectRow(int)
Deselects a row.
 o deselectRowByKey(Object)
Deselects the first row with the specified key.
 o elementChanged(TableEvent)
An element's data changed.
 o getBackgroundImage()
Returns the current background image or null if none is set.
 o getCaptionBarBackground()
Returns the current background color of the caption bar.
 o getCaptionBarBackgroundImage()
Returns the current background image of the caption bar or null if none is set.
 o getCaptionBarForeground()
Returns the current foreground color of the caption bar.
 o getCaptionBarHeight()
Returns the current caption bar height.
 o getColumn(int)
Returns the array of values in the column, or null if column specified is invalid.
 o getColumnCount()
Returns the number of columns in the listbox.
 o getColumnInfo(int)
Returns a reference to specified column or null if no such column index exists.
 o getContinuousDrag()
Returns whether the columns are resized as the caption is resized or only at the end of the drag.
 o getHorizontalAdjuster()
Returns the horizontal adjuster.
 o getIndexByKey(Object)
Returns the index of the first row that has the specified key or -1 if no row has that key.
 o getKeys()
Returns the array of key values, or null if there are no columns or rows in the list.
 o getMinimumSize()
Returns the minimum size required for the view.
 o getModel()
Returns the model.
 o getMultipleSelections()
Returns whether multiple selections are allowed.
 o getPreferredSize()
Returns the preferred size for the view.
 o getRow(int)
Returns the array of values in the row, or null if row specified is invalid.
 o getRowByKey(Object)
Returns an array of row values with the specified key or null if no row has the specified key.
 o getRowCount()
Returns the number of rows in the listbox.
 o getRowHeight()
Returns the current height of the listbox rows.
 o getRowKey(int)
Returns the key value for the specified row.
 o getSelectedColumnIndex()
Returns the index of the selected column.
 o getSelectedIndex()
Returns the index of the first selected row or -1 if no row is selected.
 o getSelectedIndexes()
Returns an array of indexes of the selected rows.
 o getSelectedObjects()
Returns an array of selected row arrays.
 o getSelectedRow()
Returns the first selected row.
 o getSelectedRows()
Returns all of the selected rows as an array of rows.
 o getSelectionBackground()
Gets the current background color for all selected rows.
 o getSelectionForeground()
Gets the foreground color for all selected rows.
 o getSeparatorColor()
Returns the current color of the horizontal and vertical separators.
 o getUpdate()
Returns whether update are turned on or off.
 o getVerticalAdjuster()
Returns the vertical adjuster.
 o insertRow(Object[], int)
Inserts a row of data into the listbox with the default key value.
 o insertRow(Object[], Object, int)
Inserts a row of data into the listbox.
 o insertRows(Object[][], int)
Inserts the given rows at the specified index with the default key value.
 o insertRows(Object[][], Object[], int)
Inserts the given rows at the specified index and the key values.
 o invertSelections()
Inverts the selected rows -- selected rows become deselected and deselected rows become selected.
 o isBorderVisible()
Returns true if the listbox border is showing, false otherwise.
 o isCaptionBarVisible()
Returns whether or not the caption bar is being shown.
 o isFocusTraversable()
The listbox is always traversable.
 o isHorizontalScrollbarVisible()
Returns whether the horizontal scrollbar is shown. Deprecated.
 o isHorizontalSeparatorVisible()
Returns whether horizontal separator lines are shown between each listbox row.
 o isSelectable()
Returns true if the listbox is selectable, false otherwise.
 o isVerticalScrollbarVisible()
Returns whether the vertical scrollbar is shown. Deprecated.
 o isVerticalSeparatorVisible()
Returns whether the vertical separators are being shown.
 o keyPressed(KeyEvent)
A key was pressed.
 o keyReleased(KeyEvent)
A key was released.
 o keyTyped(KeyEvent)
A key was typed.
 o listboxColumnToTableColumn(int)
Returns the physical table column associated with the specified listbox column, or -1 if no mapping exists.
 o listboxRowToTableRow(int)
Returns the physical table row associated with the specified listbox row, or -1 if no mapping exists.
 o makeRowVisible(int)
Makes the specified row index visible in the listbox.
 o mouseClicked(MouseEvent)
A mouse button was clicked.
 o mouseEntered(MouseEvent)
The mouse cursor entered the component.
 o mouseExited(MouseEvent)
The mouse cursor exited the component.
 o mousePressed(MouseEvent)
A mouse button was pressed.
 o mouseReleased(MouseEvent)
A mouse button was released.
 o paint(Graphics)
Handles painting of the border.
 o 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.
 o removeAdjustmentListener(AdjustmentListener, int)
Removes a scrollbar adjustment listener. Deprecated.
 o removeAllColumns()
Removes all of the columns from the listbox.
 o removeAllRows()
Removes all of the rows from the listbox.
 o removeCaptionBarListener(CaptionBarListener)
Removes a caption bar event listener.
 o removeColumn(int)
Removes a column from the listbox.
 o removeItemListener(ItemListener)
Removes an item listener
 o removeKeyListener(KeyListener)
Removes a key listener.
 o removeListboxListener(ListboxListener)
Removes a listbox event listener.
 o removeMouseListener(MouseListener)
Removes a mouse listener.
 o removeMouseMotionListener(MouseMotionListener)
Removes a mouse listener.
 o removeRow(int)
Removes a row from the listbox.
 o removeRows(int, int)
Removes a series of rows.
 o replaceColumn(Object[], int)
Replaces the elements in the given column with the array of objects specified.
 o replaceRow(Object[], int)
Replaces all elements of the given row with the specified elements.
 o rowAdded(TableEvent)
A row was added.
 o rowChanged(TableEvent)
Row was changed.
 o rowInfoChanged(TableEvent)
Row information changed.
 o rowInserted(TableEvent)
A row was inserted.
 o rowRemoved(TableEvent)
A row was removed.
 o selectAllRows()
Selects all of the rows.
 o selectColumn(int)
Selects the specified column.
 o selectRow(int)
Selects a row.
 o selectRowByKey(Object)
Selects the first row with the specified key.
 o setBackgroundImage(Image)
Sets the background image for drawing.
 o setBorderVisible(boolean)
Shows or hides the listbox border.
 o setBounds(int, int, int, int)
Sets the bounds of the control.
 o setCaptionBarBackground(Color)
Sets the background color of the caption bar.
 o setCaptionBarBackgroundImage(Image)
Sets the background image of the caption bar.
 o setCaptionBarForeground(Color)
Sets the foreground color of the caption bar.
 o setCaptionBarHeight(int)
Sets the size of the caption bar to the specified height.
 o setCaptionBarVisible(boolean)
Shows or hides the caption bar.
 o setContinuousDrag(boolean)
Sets whether the columns are resized as the caption is resized or only at the end of the drag.
 o setHorizontalScrollbarVisible(boolean)
Shows or hides the horizontal scrollbar. Deprecated.
 o setHorizontalSeparatorVisible(boolean)
Shows or hides a horizontal separator line between each row.
 o setLayout(LayoutManager)
Not allowed to reset layout manager.
 o setModel(TableModel)
Sets the model.
 o setMultipleSelections(boolean)
Sets whether multiple selections are allowed in the listbox.
 o setRowHeight(int)
Sets the height of the listbox rows.
 o setRowKey(Object, int)
Sets the key to the specified row.
 o setSelectable(boolean)
Sets whether the user is allowed to select rows in the listbox.
 o setSelectionBackground(Color)
Sets the background color for all selected rows.
 o setSelectionForeground(Color)
Sets the foreground color for all selected rows.
 o setSeparatorColor(Color)
Sets the color of the horizontal and vertical separators.
 o setUpdate(boolean)
Sets whether updates occur.
 o setVerticalScrollbarVisible(boolean)
Shows or hides the vertical scrollbar. Deprecated.
 o setVerticalSeparatorVisible(boolean)
Show or hides a vertical separator line between each column.
 o sort()
Sorts the currently selected column.
 o tableChanged(TableEvent)
Table completely changed.
 o tableRefreshed(TableEvent)
Table refreshed.
 o toString()
Returns a text representation of this instance of MultiColumnListbox.
 o update(Graphics)
public void repaint() { if (fUpdate) { // repaint components fCaptionBar.repaint(); fViewArea.repaint(); fHScrollbar.repaint(); fVScrollbar.repaint(); } } /** Don't clear area -- not needed.

Variables

 o DEFAULT_KEY
 public static final Object DEFAULT_KEY
Default row key value (null).

 o DEFAULT_ROW_HEIGHT
 public static final int DEFAULT_ROW_HEIGHT
Default row height (20).

 o DEFAULT_CAPTIONBAR_HEIGHT
 public static final int DEFAULT_CAPTIONBAR_HEIGHT
Default caption bar height (20).

 o DEFAULT_BACKGROUND_COLOR
 public static final Color DEFAULT_BACKGROUND_COLOR
Default background color (Color.lightGray).

 o DEFAULT_FOREGROUND_COLOR
 public static final Color DEFAULT_FOREGROUND_COLOR
Default foreground color (Color.black).

 o DEFAULT_SEPARATOR_COLOR
 public static final Color DEFAULT_SEPARATOR_COLOR
Default separator color (Color.black).

 o DEFAULT_SELECTION_BACKGROUND
 public static final Color DEFAULT_SELECTION_BACKGROUND
Default selected background color (Color.gray).

 o DEFAULT_SELECTION_FOREGROUND
 public static final Color DEFAULT_SELECTION_FOREGROUND
Default selected foreground color (Color.black).

Constructors

 o MultiColumnListbox
 public MultiColumnListbox()
Default constructor.

 o MultiColumnListbox
 public MultiColumnListbox(TableModel table)
Constructs a listbox view with the given table.

Methods

 o setLayout
 public void setLayout(LayoutManager layout)
Not allowed to reset layout manager.

Overrides:
setLayout in class Container
 o addMouseListener
 public void addMouseListener(MouseListener listener)
Adds a mouse listener.

Overrides:
addMouseListener in class Component
 o removeMouseListener
 public void removeMouseListener(MouseListener listener)
Removes a mouse listener.

Overrides:
removeMouseListener in class Component
 o addMouseMotionListener
 public void addMouseMotionListener(MouseMotionListener listener)
Adds a mouse motion listener.

Overrides:
addMouseMotionListener in class Component
 o removeMouseMotionListener
 public void removeMouseMotionListener(MouseMotionListener listener)
Removes a mouse listener.

Overrides:
removeMouseMotionListener in class Component
 o addKeyListener
 public void addKeyListener(KeyListener listener)
Adds a key listener.

Overrides:
addKeyListener in class Component
 o removeKeyListener
 public void removeKeyListener(KeyListener listener)
Removes a key listener.

Overrides:
removeKeyListener in class Component
 o setBounds
 public synchronized void setBounds(int x,
                                    int y,
                                    int w,
                                    int h)
Sets the bounds of the control.

Overrides:
setBounds in class Component
 o getPreferredSize
 public synchronized Dimension getPreferredSize()
Returns the preferred size for the view.

Overrides:
getPreferredSize in class Container
 o getMinimumSize
 public synchronized Dimension getMinimumSize()
Returns the minimum size required for the view.

Overrides:
getMinimumSize in class Container
 o addListboxListener
 public void addListboxListener(ListboxListener listener)
Adds a listbox event listener.

Parameters:
listener - The listener to add.
See Also:
removeListboxListener
 o removeListboxListener
 public void removeListboxListener(ListboxListener listener)
Removes a listbox event listener.

Parameters:
listener - The listener to remove.
See Also:
addListboxListener
 o addCaptionBarListener
 public void addCaptionBarListener(CaptionBarListener listener)
Adds a caption bar event listener.

Parameters:
listener - The listener to add.
See Also:
removeCaptionBarListener
 o removeCaptionBarListener
 public void removeCaptionBarListener(CaptionBarListener listener)
Removes a caption bar event listener.

Parameters:
listener - The listener to remove.
See Also:
addCaptionBarListener
 o addAdjustmentListener
 public void addAdjustmentListener(AdjustmentListener listener,
                                   int scrollbar)
Note: addAdjustmentListener() is deprecated. Use getHorizontalAdjustor and getVerticalAdjuster to obtain an Adjustable object reference for the horizontal and vertical scrollbars, respectively. With that reference, you can add and remove adjustment listeners.

Adds a scrollbar adjustment listener.

Parameters:
listener - The listener to add.
scrollbar - The orientation of the scrollbar to listen to (e.g. Scrollbar.VERTICAL).
 o removeAdjustmentListener
 public void removeAdjustmentListener(AdjustmentListener listener,
                                      int scrollbar)
Note: removeAdjustmentListener() is deprecated. Use getHorizontalAdjustor and getVerticalAdjuster to obtain an Adjustable object reference for the horizontal and vertical scrollbars, respectively. With that reference, you can add and remove adjustment listeners.

Removes a scrollbar adjustment listener.

Parameters:
listener - The listener to remove.
scrollbar - The orientation of the scrollbar.
 o getHorizontalAdjuster
 public Adjustable getHorizontalAdjuster()
Returns the horizontal adjuster.

 o getVerticalAdjuster
 public Adjustable getVerticalAdjuster()
Returns the vertical adjuster.

 o setModel
 public synchronized void setModel(TableModel table)
Sets the model.

 o getModel
 public TableModel getModel()
Returns the model.

 o 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
 o removeItemListener
 public void removeItemListener(ItemListener listener)
Removes an item listener

See Also:
addItemListener
 o getSelectedObjects
 public Object[] getSelectedObjects()
Returns an array of selected row arrays.

See Also:
ItemListener
 o sort
 public synchronized void sort()
Sorts the currently selected column.

See Also:
isSortable, setSorter
 o isFocusTraversable
 public boolean isFocusTraversable()
The listbox is always traversable.

Overrides:
isFocusTraversable in class Component
 o setSeparatorColor
 public void setSeparatorColor(Color color)
Sets the color of the horizontal and vertical separators.

Parameters:
color - The new separator color.
See Also:
getSeparatorColor
 o getSeparatorColor
 public Color getSeparatorColor()
Returns the current color of the horizontal and vertical separators.

See Also:
setSeparatorColor
 o setUpdate
 public synchronized 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
 o getUpdate
 public boolean getUpdate()
Returns whether update are turned on or off.

See Also:
setUpdate
 o setCaptionBarBackground
 public void setCaptionBarBackground(Color color)
Sets the background color of the caption bar.

 o getCaptionBarBackground
 public Color getCaptionBarBackground()
Returns the current background color of the caption bar.

 o setCaptionBarForeground
 public void setCaptionBarForeground(Color color)
Sets the foreground color of the caption bar.

 o getCaptionBarForeground
 public Color getCaptionBarForeground()
Returns the current foreground color of the caption bar.

 o setCaptionBarVisible
 public void setCaptionBarVisible(boolean visible)
Shows or hides the caption bar.

Parameters:
visible - True to show, false to hide.
See Also:
isCaptionBarVisible
 o isCaptionBarVisible
 public boolean isCaptionBarVisible()
Returns whether or not the caption bar is being shown.

See Also:
setCaptionBarVisible
 o 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
 o getCaptionBarHeight
 public int getCaptionBarHeight()
Returns the current caption bar height.

See Also:
setCaptionBarHeight
 o 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
 o 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
 o setRowHeight
 public synchronized void setRowHeight(int height)
Sets the height of the listbox rows.

Parameters:
height - The new height.
See Also:
getRowHeight
 o getRowHeight
 public int getRowHeight()
Returns the current height of the listbox rows.

See Also:
setRowHeight
 o 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
 o getMultipleSelections
 public boolean getMultipleSelections()
Returns whether multiple selections are allowed.

See Also:
setMultipleSelections
 o setHorizontalSeparatorVisible
 public synchronized 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
 o isHorizontalSeparatorVisible
 public boolean isHorizontalSeparatorVisible()
Returns whether horizontal separator lines are shown between each listbox row.

See Also:
setHorizontalSeparatorVisible
 o setVerticalSeparatorVisible
 public synchronized 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
 o isVerticalSeparatorVisible
 public boolean isVerticalSeparatorVisible()
Returns whether the vertical separators are being shown.

See Also:
setVerticalSeparatorVisible
 o 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
 o 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
 o 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
 o 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
 o setBorderVisible
 public synchronized void setBorderVisible(boolean visible)
Shows or hides the listbox border.

Parameters:
visible - True to show the border, false to hide.
See Also:
isBorderVisible
 o isBorderVisible
 public boolean isBorderVisible()
Returns true if the listbox border is showing, false otherwise.

See Also:
setBorderVisible
 o 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
 o setCaptionBarBackgroundImage
 public void setCaptionBarBackgroundImage(Image image)
Sets the background image of the caption bar. 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
 o getCaptionBarBackgroundImage
 public Image getCaptionBarBackgroundImage()
Returns the current background image of the caption bar or null if none is set.

See Also:
setBackgroundImage
 o getBackgroundImage
 public Image getBackgroundImage()
Returns the current background image or null if none is set.

See Also:
setBackgroundImage
 o getColumnCount
 public synchronized int getColumnCount()
Returns the number of columns in the listbox.

See Also:
addColumn, getColumnInfo
 o getColumn
 public synchronized Object[] getColumn(int col)
Returns the array of values in the column, or null if column specified is invalid.

Parameters:
col - The column to return.
See Also:
addColumn
 o autoSizeColumn
 public synchronized void autoSizeColumn(int col)
Resizes the specified column to fit the widest element currently in the column.

Parameters:
col - The column to resize
 o addColumn
 public synchronized ListboxColumn addColumn(Object 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
 o addColumns
 public void addColumns(Object 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
 o removeColumn
 public synchronized void removeColumn(int col)
Removes a column from the listbox.

Parameters:
col - The index of the column to remove.
See Also:
removeAllColumns, addColumn
 o removeAllColumns
 public synchronized void removeAllColumns()
Removes all of the columns from the listbox.

See Also:
removeColumn
 o getColumnInfo
 public synchronized ListboxColumn getColumnInfo(int column)
Returns a reference to specified column or null if no such column index exists.

Parameters:
column - The column to return.
 o replaceColumn
 public synchronized 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, null values 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
 o makeRowVisible
 public synchronized void makeRowVisible(int row)
Makes the specified row index visible in the listbox.

 o getRowCount
 public synchronized int getRowCount()
Returns the number of rows in the listbox.

See Also:
getColumnCount
 o getRow
 public synchronized Object[] getRow(int row)
Returns the array of values in the row, or null if row specified is invalid.

Parameters:
row - The row to return.
See Also:
addRow
 o 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
 o addRow
 public synchronized 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
 o 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
 o 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
 o removeRow
 public synchronized void removeRow(int row)
Removes a row from the listbox.

Parameters:
row - The row to remove.
See Also:
removeRows, getRow, addRow, replaceRow
 o removeAllRows
 public synchronized void removeAllRows()
Removes all of the rows from the listbox.

See Also:
removeRow
 o 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
 o 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
 o insertRow
 public synchronized void insertRow(Object elements[],
                                    Object key,
                                    int row)
Inserts a row of data into the listbox.

Note: Because the listbox data was moved into a separate model Bean, insertRow may not work as you expect. If you are using the listbox the same way as in previous versions, you will not notice any change.

However, if you are working with a model as your data source, then you have to be careful. In this situation the listbox becomes a view of the data in the model -- the listbox does not rearrange the physical ordering of rows during a sort. This is done so that multiple listboxes can share the same data source but the sort of one listbox will not affect the other listboxes -- each listbox retains its own sort "state". An insertRow in this scheme will insert the row into the physical model at the row specified but will be reflected in the listbox's view as an added row.

Parameters:
elements - The row of data to insert.
key - The key for this row of data
row - Which row to insert new row before.
 o insertRows
 public void insertRows(Object rows[][],
                        int row)
Inserts the given rows at the specified index with the default key value.

Parameters:
rows - The rows to insert.
row - The index where to insert.
See Also:
insertRow
 o 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
 o replaceRow
 public synchronized void replaceRow(Object elements[],
                                     int row)
Replaces all elements of the given row with the specified elements. If the array of elements does not contain the same number of elements for the number of columns in the listbox, null values 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
 o getKeys
 public synchronized 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
 o getRowByKey
 public synchronized 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
 o getIndexByKey
 public synchronized 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
 o setRowKey
 public synchronized 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
 o getRowKey
 public synchronized Object getRowKey(int row)
Returns the key value for the specified row.

Parameters:
row - The row to return the key for.
See Also:
setRowKey
 o listboxColumnToTableColumn
 public synchronized int listboxColumnToTableColumn(int col)
Returns the physical table column associated with the specified listbox column, or -1 if no mapping exists.

Parameters:
col - The listbox column.
See Also:
listboxRowToTableRow
 o listboxRowToTableRow
 public synchronized int listboxRowToTableRow(int row)
Returns the physical table row associated with the specified listbox row, or -1 if no mapping exists.

Parameters:
row - The listbox row.
See Also:
listboxColumnToTableColumn
 o setSelectable
 public synchronized void setSelectable(boolean selectable)
Sets whether the user is allowed to select rows in the listbox. The listbox is selectable by default.

Parameters:
selectable - True if selectable, false otherwise.
See Also:
isSelectable
 o isSelectable
 public boolean isSelectable()
Returns true if the listbox is selectable, false otherwise.

See Also:
setSelectable
 o selectColumn
 public synchronized void selectColumn(int col)
Selects the specified column.

Parameters:
col - The index of the column to select.
See Also:
ListboxColumn, addColumn, getColumn, replaceColumn
 o selectRow
 public synchronized void selectRow(int row)
Selects a row.

Parameters:
row - Which row to select.
See Also:
deselectRow, selectAllRows, selectRowByKey
 o invertSelections
 public synchronized void invertSelections()
Inverts the selected rows -- selected rows become deselected and deselected rows become selected. This method only works if multiple selection mode is set to true.

See Also:
setMultipleSelections
 o selectAllRows
 public synchronized 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
 o selectRowByKey
 public synchronized void selectRowByKey(Object key)
Selects the first row with the specified key.

Parameters:
key - The key of the row to select.
See Also:
deselectRowByKey, selectRow, selectAllRows
 o deselectRow
 public synchronized void deselectRow(int row)
Deselects a row.

Parameters:
row - The row to deselect.
See Also:
deselectAllRows, deselectRowByKey, selectRow
 o deselectAllRows
 public synchronized void deselectAllRows()
Deselects all of the rows.

See Also:
deselectRow, deselectRowByKey, selectAllRows
 o deselectRowByKey
 public synchronized void deselectRowByKey(Object key)
Deselects the first row with the specified key.

Parameters:
key - The key of the row to deselect.
See Also:
deselectRow, deselectAllRows, selectRowByKey
 o getSelectedColumnIndex
 public int getSelectedColumnIndex()
Returns the index of the selected column.

 o getSelectedIndex
 public synchronized int getSelectedIndex()
Returns the index of the first selected row or -1 if no row is selected.

See Also:
selectRow, deselectRow, getSelectedIndexes, getSelectedRow, getSelectedRows
 o getSelectedIndexes
 public synchronized 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
 o getSelectedRow
 public synchronized 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
 o getSelectedRows
 public synchronized Object[][] getSelectedRows()
Returns all of the selected rows as an array of rows.

See Also:
getSelectedRow
 o setVerticalScrollbarVisible
 public void setVerticalScrollbarVisible(boolean visible)
Note: setVerticalScrollbarVisible() is deprecated. The scrollbars now show or hide automatically.

Shows or hides the vertical scrollbar.

 o isVerticalScrollbarVisible
 public boolean isVerticalScrollbarVisible()
Note: isVerticalScrollbarVisible() is deprecated. The scrollbars now show or hide automatically.

Returns whether the vertical scrollbar is shown.

 o setHorizontalScrollbarVisible
 public void setHorizontalScrollbarVisible(boolean visible)
Note: setHorizontalScrollbarVisible() is deprecated. The scrollbars now show or hide automatically.

Shows or hides the horizontal scrollbar.

 o isHorizontalScrollbarVisible
 public boolean isHorizontalScrollbarVisible()
Note: isHorizontalScrollbarVisible() is deprecated. The scrollbars now show or hide automatically.

Returns whether the horizontal scrollbar is shown.

 o update
 public void update(Graphics g)
public void repaint() { if (fUpdate) { // repaint components fCaptionBar.repaint(); fViewArea.repaint(); fHScrollbar.repaint(); fVScrollbar.repaint(); } } /** Don't clear area -- not needed.

Overrides:
update in class Container
 o paint
 public void paint(Graphics g)
Handles painting of the border. The component pieces of the listbox paint themselves.

Overrides:
paint in class Container
 o tableRefreshed
 public synchronized void tableRefreshed(TableEvent evt)
Table refreshed.

 o tableChanged
 public void tableChanged(TableEvent evt)
Table completely changed.

 o columnChanged
 public void columnChanged(TableEvent evt)
Column was changed.

 o rowChanged
 public void rowChanged(TableEvent evt)
Row was changed.

 o elementChanged
 public void elementChanged(TableEvent evt)
An element's data changed.

 o columnInfoChanged
 public void columnInfoChanged(TableEvent evt)
Column information changed.

 o columnAdded
 public synchronized void columnAdded(TableEvent evt)
A column was added.

 o columnRemoved
 public synchronized void columnRemoved(TableEvent evt)
A column was removed.

 o columnInserted
 public void columnInserted(TableEvent evt)
A column was inserted.

 o rowInfoChanged
 public void rowInfoChanged(TableEvent evt)
Row information changed.

 o rowAdded
 public synchronized void rowAdded(TableEvent evt)
A row was added.

 o rowRemoved
 public synchronized void rowRemoved(TableEvent evt)
A row was removed.

 o rowInserted
 public synchronized void rowInserted(TableEvent evt)
A row was inserted.

 o captionSelected
 public synchronized void captionSelected(CaptionBarEvent evt)
A caption was selected.

 o captionResized
 public synchronized void captionResized(CaptionBarEvent evt)
A caption was resized. If the click count on a caption resize event is greater than 1, then the user is requesting an auto sizing of the column. This request can be ignored by the caption bar owner, however.

 o mouseClicked
 public void mouseClicked(MouseEvent evt)
A mouse button was clicked.

 o mousePressed
 public void mousePressed(MouseEvent evt)
A mouse button was pressed.

 o mouseReleased
 public void mouseReleased(MouseEvent evt)
A mouse button was released.

 o mouseEntered
 public void mouseEntered(MouseEvent evt)
The mouse cursor entered the component.

 o mouseExited
 public void mouseExited(MouseEvent evt)
The mouse cursor exited the component.

 o keyTyped
 public void keyTyped(KeyEvent evt)
A key was typed.

 o keyPressed
 public void keyPressed(KeyEvent evt)
A key was pressed.

 o keyReleased
 public void keyReleased(KeyEvent evt)
A key was released.

 o adjustmentValueChanged
 public synchronized void adjustmentValueChanged(AdjustmentEvent evt)
Adjustment value changed.

 o 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.
 o allowSelection
 protected boolean allowSelection(ListboxEvent event)
This function acts as a mask to allow/disallow selection given a specific row, column, and relative (x,y) within it. The default is to always allow selection, but subclasses can disallow it.

Parameters:
event - The event that will be passed to listeners if the selection is allowed. This event object can be queried for the event type, row, col, and (x,y) coordinates of the mouse click.
Returns:
Returns true if the selection is allowed, false otherwise. The default return value is true.
 o deliverEvent
 protected void deliverEvent(EventObject evt)
This function delivers listbox related events. By overriding this method in a subclass, you can modify outgoing listbox events or even decide not to deliver certain events. The default implementation of this method handles ListboxEvents and ItemEvents.

Parameters:
event - The event to deliver.
 o createCaption
 public ListboxCaption createCaption()
This function is a "factory" method that creates a listbox caption. By overriding this method in a subclass, you can define a new look to a listbox caption.

 o toString
 public String toString()
Returns a text representation of this instance of MultiColumnListbox.

Returns:
Returns string representation of listbox.
Overrides:
toString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index