All Packages Class Hierarchy This Package Previous Next Index
Class jp.kyasu.awt.TableList
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----jp.kyasu.awt.KContainer
|
+----jp.kyasu.awt.EventProxyContainer
|
+----jp.kyasu.awt.TableList
- public class TableList
- extends EventProxyContainer
- implements ItemSelectable, ActionListener, ItemListener
The TableList
component presents the user with a scrolling
table list that has multiple columns. The table list can be set up so that
the user can choose either one row or multiple rows.
A TableList is an MVC-based component. The model of the TableList is
a TextListModel
object, the view of the TableList is a
TextListView (TableListView)
object, and the controller
of the TableList is a TextListController
object.
A TableList emits a ListActionEvent
and a
ListItemEvent
.
- Version:
- 12 Dec 1998
- Author:
- Kazuki YASUMATSU
- See Also:
- ListModel, TextListModel, TableListView, TextListView, TextListController, ListActionEvent, ListItemEvent
-
AUTO_RESIZE_ALL_COLUMNS
- Proportionately resize all columns when table is resized
-
AUTO_RESIZE_LAST_COLUMN
- Auto resize last column only when table is resized
-
AUTO_RESIZE_OFF
- Do not auto resize column when table is resized.
-
DEFAULT_BUTTON_ALIGN
- The default column button alignment.
-
DEFAULT_TABLE_STYLE
- The default table list style.
-
MULTIPLE_SELECTIONS
- Allows AWT style multiple selections.
-
SHIFT_MULTIPLE_SELECTIONS
- Allows Windows style multiple selections.
-
SINGLE_SELECTION
- Allows single selection.
-
TableList(int, String[])
- Constructs an empty table list with the specified number of visual
lines and column titles.
-
TableList(int, String[], int[])
- Constructs an empty table list with the specified number of visual
lines, column titles, and widths of the columns.
-
TableList(int, String[], int[], int[], RichTextStyle)
- Constructs an empty table list with the specified column titles,
alignments of the column titles, widths of the columns, and the
rich text style of the table list.
-
TableList(int, String[], int[], RichTextStyle)
- Constructs an empty table list with the specified column titles,
widths of the columns, and the rich text style of the table list.
-
TableList(String[])
- Constructs an empty table list with the specified column titles.
-
TableList(TextListModel, int, Button[])
- Constructs a table list with the specified model, number of visual
lines, and column buttons.
-
TableList(TextListModel, int, String[])
- Constructs a table list with the specified model, number of visual
lines, and column titles.
-
TableList(TextListModel, int, String[], int[])
- Constructs a table list with the specified model, number of visual
lines, column titles, and alignments of the column titles.
-
actionPerformed(ActionEvent)
- Invoked when an action occurs.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events from
this list.
-
addItem(String[])
- Adds the specified string row item to the end of the table list.
-
addItem(String[], int)
- Adds the specified string row item to the specified row index.
-
addItem(Text[])
- Adds the specified text row item to the end of the table list.
-
addItem(Text[], int)
- Adds the specified text row item to the specified row index.
-
addItemListener(ItemListener)
- Adds the specified item listener to receive item events from this list.
-
addTextItem(Text[])
- Adds the specified text row item to the end of the table list.
-
addTextItem(Text[], int)
- Adds the specified text row item to the specified row index.
-
deselect(int)
- Deselects the row at the specified index.
-
getAutoResizeMode()
- Returns the auto resize mode of the panel.
-
getColumnButtons()
- Returns the buttons for the column titles.
-
getColumnCount()
- Returns the number of columns in the list.
-
getColumnTitles()
- Returns the column titles.
-
getController()
- Returns the controller of this list.
-
getItem(int, int)
- Returns the string item associated with the specified index (row)
and column.
-
getItemCount()
- Returns the number of items in the list.
-
getItems(int)
- Returns the string items associated with the specified column index.
-
getMinimumSize()
- Returns the minimum size of this table list.
-
getMinimumSize(int)
- Returns the minumum dimensions for a table list with the specified
number of visual lines.
-
getModel()
- Returns the model of this list.
-
getPopupMenu()
- Returns the popup menu of this list.
-
getPreferredSize()
- Returns the preferred size of this table list.
-
getPreferredSize(int)
- Returns the preferred dimensions for a table list with the specified
number of visual lines.
-
getRowItem(int)
- Returns the item associated with the specified row index.
-
getRowItems(int)
- Returns the string items associated with the specified row index.
-
getRows()
- Get the number of visible lines in this table list.
-
getRowTextItem(int)
- Returns the text item associated with the specified row index.
-
getRowTextItems(int)
- Returns the text items associated with the specified row index.
-
getScrollbarThickness()
- Returns the thickness of the scroll bar.
-
getSelectedIndex()
- Gets the index of the selected row on the list,
-
getSelectedIndexes()
- Gets the selected row indexes on the list.
-
getSelectedObjects()
- Returns the selected items on the list in an array of Objects.
-
getSelectionBackground()
- Returns the selection background color.
-
getSelectionForeground()
- Returns the selection foreground color.
-
getSelectionMode()
- Returns the selection mode.
-
getTextItem(int, int)
- Returns the text item associated with the specified index (row)
and column.
-
getTextItems(int)
- Returns the text items associated with the specified column index.
-
getView()
- Returns the view of this list.
-
getVisibleIndex()
- Gets the index of the row that was last made visible by the method
makeVisible
.
-
isClickToFocus()
- Tests if the list requests the focus when the mouse is clicked.
-
isDeselectionEnabled()
- Tests if the deselection is enabled when the selection mode is a single
selection.
-
isIndexSelected(int)
- Determines if the specified row in this scrolling list is selected.
-
isMouseFocus()
- Tests if the list requests the focus when the mouse enters the list.
-
isMultipleMode()
- Determines whether this list allows multiple selections.
-
itemStateChanged(ItemEvent)
- Invoked when an item's state has been changed.
-
makeVisible(int)
- Makes the row at the specified index visible.
-
remove(int)
- Remove the item at the specified row position.
-
remove(int, int)
- Remove the items at the specified row range.
-
remove(int[])
- Remove the items at the specified row indices.
-
removeActionListener(ActionListener)
- Removes the specified action listener so that it no longer receives
action events from this list.
-
removeAll()
- Removes all items from the list.
-
removeItemListener(ItemListener)
- Removes the specified item listener so that it no longer receives
item events from this list.
-
removeSelectedIndexes()
- Remove the items at the indices of the selected rows.
-
replaceItem(String[], int)
- Replaces the item at the specified row index with the new strings.
-
replaceItem(Text[], int)
- Replaces the item at the specified row index with the new texts.
-
replaceTextItem(Text[], int)
- Replaces the item at the specified row index with the new texts.
-
select(int)
- Selects the row at the specified index in the scrolling list.
-
setAutoResizeMode(int)
- Sets the the auto resize mode of the panel.
-
setBackground(Color)
- Sets the background color of this list.
-
setClickToFocus()
- Makes the list request the focus when the mouse is clicked.
-
setCursor(Cursor)
- Sets the cursor of this list.
-
setDeselectionEnabled(boolean)
- Makes the deselection enabled when the selection mode is a single
selection.
-
setEnabled(boolean)
- Enables or disables this list.
-
setFont(Font)
- Sets the font of this list.
-
setForeground(Color)
- Sets the foreground color of this list.
-
setItem(int, int, String)
- Sets the item associated with the specified index (row) and column
to the specified string value.
-
setItem(int, int, Text)
- Sets the item associated with the specified index (row) and column
to the specified text value.
-
setItems(String[][])
- Sets the items of the list to the specified string row by column items.
-
setItems(Text[][])
- Sets the items of the list to the specified text row by column items.
-
setMouseFocus()
- Makes the list request the focus when the mouse enters the list.
-
setMultipleMode(boolean)
- Sets the flag that determines whether this list allows multiple
selections.
-
setPopupMenu(PopupMenu)
- Sets the popup menu of this list.
-
setRows(int)
- Sets the number of visible lines in this table list.
-
setScrollbarThickness(int)
- Sets the thickness of the scroll bar.
-
setSelectionBackground(Color)
- Sets the selection background color.
-
setSelectionForeground(Color)
- Sets the selection foreground color.
-
setSelectionMode(int)
- Sets the selection mode.
-
setTextItem(int, int, Text)
- Sets the item associated with the specified index (row) and column
to the specified text value.
-
setTextItems(Text[][])
- Sets the items of the list to the specified text row by column items.
SINGLE_SELECTION
public static final int SINGLE_SELECTION
- Allows single selection.
MULTIPLE_SELECTIONS
public static final int MULTIPLE_SELECTIONS
- Allows AWT style multiple selections.
SHIFT_MULTIPLE_SELECTIONS
public static final int SHIFT_MULTIPLE_SELECTIONS
- Allows Windows style multiple selections.
AUTO_RESIZE_OFF
public static final int AUTO_RESIZE_OFF
- Do not auto resize column when table is resized.
AUTO_RESIZE_LAST_COLUMN
public static final int AUTO_RESIZE_LAST_COLUMN
- Auto resize last column only when table is resized
AUTO_RESIZE_ALL_COLUMNS
public static final int AUTO_RESIZE_ALL_COLUMNS
- Proportionately resize all columns when table is resized
DEFAULT_TABLE_STYLE
public static final RichTextStyle DEFAULT_TABLE_STYLE
- The default table list style.
DEFAULT_BUTTON_ALIGN
public static final int DEFAULT_BUTTON_ALIGN
- The default column button alignment.
TableList
public TableList(String columnTitles[])
- Constructs an empty table list with the specified column titles.
- Parameters:
- columnTitles - the column titles.
TableList
public TableList(int rows,
String columnTitles[])
- Constructs an empty table list with the specified number of visual
lines and column titles.
- Parameters:
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
TableList
public TableList(int rows,
String columnTitles[],
int columnWidths[])
- Constructs an empty table list with the specified number of visual
lines, column titles, and widths of the columns.
- Parameters:
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
- columnWidths - the widths of the columns, or null.
- See Also:
- LEFT, CENTER, RIGHT
TableList
public TableList(int rows,
String columnTitles[],
int columnWidths[],
RichTextStyle richTextStyle)
- Constructs an empty table list with the specified column titles,
widths of the columns, and the rich text style of the table list.
- Parameters:
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
- columnWidths - the widths of the columns, or null.
- richTextStyle - the rich text style of the table list.
- See Also:
- LEFT, CENTER, RIGHT
TableList
public TableList(int rows,
String columnTitles[],
int columnAligns[],
int columnWidths[],
RichTextStyle richTextStyle)
- Constructs an empty table list with the specified column titles,
alignments of the column titles, widths of the columns, and the
rich text style of the table list.
- Parameters:
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
- columnAligns - the alignments of the column titles, or null.
- columnWidths - the widths of the columns, or null.
- richTextStyle - the rich text style of the table list.
- See Also:
- LEFT, CENTER, RIGHT
TableList
public TableList(TextListModel model,
int rows,
String columnTitles[])
- Constructs a table list with the specified model, number of visual
lines, and column titles.
- Parameters:
- model - the text list model.
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
TableList
public TableList(TextListModel model,
int rows,
String columnTitles[],
int columnAligns[])
- Constructs a table list with the specified model, number of visual
lines, column titles, and alignments of the column titles.
- Parameters:
- model - the text list model.
- rows - the number of visual lines in the table list.
- columnTitles - the column titles.
- columnAligns - the alignments of the column titles, or null.
- See Also:
- LEFT, CENTER, RIGHT
TableList
public TableList(TextListModel model,
int rows,
Button buttons[])
- Constructs a table list with the specified model, number of visual
lines, and column buttons.
- Parameters:
- model - the text list model.
- rows - the number of visual lines in the table list.
- buttons - the buttons for column titles.
addItemListener
public synchronized void addItemListener(ItemListener l)
- Adds the specified item listener to receive item events from this list.
- Parameters:
- l - the item listener.
removeItemListener
public synchronized void removeItemListener(ItemListener l)
- Removes the specified item listener so that it no longer receives
item events from this list.
- Parameters:
- l - the item listener.
addActionListener
public synchronized void addActionListener(ActionListener l)
- Adds the specified action listener to receive action events from
this list. Action events occur when a user double-clicks
on a list item.
- Parameters:
- l - the action listener.
removeActionListener
public synchronized void removeActionListener(ActionListener l)
- Removes the specified action listener so that it no longer receives
action events from this list. Action events occur when a user
double-clicks on a list item.
- Parameters:
- l - the action listener.
itemStateChanged
public void itemStateChanged(ItemEvent e)
- Invoked when an item's state has been changed.
- See Also:
- ItemListener
actionPerformed
public void actionPerformed(ActionEvent e)
- Invoked when an action occurs.
- See Also:
- ActionListener
setForeground
public synchronized void setForeground(Color c)
- Sets the foreground color of this list.
- Overrides:
- setForeground in class Component
setBackground
public synchronized void setBackground(Color c)
- Sets the background color of this list.
- Overrides:
- setBackground in class Component
setFont
public synchronized void setFont(Font f)
- Sets the font of this list.
- Overrides:
- setFont in class Component
setCursor
public synchronized void setCursor(Cursor c)
- Sets the cursor of this list.
- Overrides:
- setCursor in class Component
setEnabled
public synchronized void setEnabled(boolean b)
- Enables or disables this list.
- Overrides:
- setEnabled in class KContainer
getPreferredSize
public Dimension getPreferredSize(int rows)
- Returns the preferred dimensions for a table list with the specified
number of visual lines.
- Parameters:
- rows - number of visual lines in the table list.
- Returns:
- the preferred dimensions for displaying this table list.
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size of this table list.
- Returns:
- the preferred dimensions for displaying this table list.
- Overrides:
- getPreferredSize in class KContainer
getMinimumSize
public Dimension getMinimumSize(int rows)
- Returns the minumum dimensions for a table list with the specified
number of visual lines.
- Parameters:
- rows - number of visual lines in the table list.
- Returns:
- the minimum dimensions for displaying this table list.
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size of this table list.
- Returns:
- the minimum dimensions needed to display this table list.
- Overrides:
- getMinimumSize in class KContainer
getAutoResizeMode
public int getAutoResizeMode()
- Returns the auto resize mode of the panel. The default is
AUTO_RESIZE_ALL_COLUMNS.
- Returns:
- the auto resize mode of the table.
- See Also:
- setAutoResizeMode
setAutoResizeMode
public void setAutoResizeMode(int mode)
- Sets the the auto resize mode of the panel.
- Parameters:
- mode - the auto resize mode.
- See Also:
- getAutoResizeMode, AUTO_RESIZE_OFF, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS
getRows
public int getRows()
- Get the number of visible lines in this table list.
- Returns:
- the number of visible lines in this table list.
- See Also:
- setRows
setRows
public void setRows(int rows)
- Sets the number of visible lines in this table list.
- Parameters:
- rows - the number of visible lines in this table list.
- See Also:
- getRows
getSelectedObjects
public Object[] getSelectedObjects()
- Returns the selected items on the list in an array of Objects.
- See Also:
- ItemSelectable
getModel
public TextListModel getModel()
- Returns the model of this list.
getView
public TextListView getView()
- Returns the view of this list.
getController
public TextListController getController()
- Returns the controller of this list.
getColumnButtons
public synchronized Button[] getColumnButtons()
- Returns the buttons for the column titles.
getColumnTitles
public synchronized String[] getColumnTitles()
- Returns the column titles.
getSelectionForeground
public Color getSelectionForeground()
- Returns the selection foreground color.
- See Also:
- setSelectionForeground
setSelectionForeground
public synchronized void setSelectionForeground(Color c)
- Sets the selection foreground color.
- See Also:
- getSelectionForeground
getSelectionBackground
public Color getSelectionBackground()
- Returns the selection background color.
- See Also:
- setSelectionBackground
setSelectionBackground
public synchronized void setSelectionBackground(Color c)
- Sets the selection background color.
- See Also:
- getSelectionBackground
getPopupMenu
public PopupMenu getPopupMenu()
- Returns the popup menu of this list.
- See Also:
- setPopupMenu
setPopupMenu
public synchronized void setPopupMenu(PopupMenu menu)
- Sets the popup menu of this list.
- See Also:
- getPopupMenu
isClickToFocus
public boolean isClickToFocus()
- Tests if the list requests the focus when the mouse is clicked.
- Returns:
-
true
if the list requests the focus when the
mouse is clicked, false
if the list requests
the focus when the mouse enters the view.
- See Also:
- isMouseFocus
isMouseFocus
public boolean isMouseFocus()
- Tests if the list requests the focus when the mouse enters the list.
- See Also:
- isClickToFocus
setClickToFocus
public void setClickToFocus()
- Makes the list request the focus when the mouse is clicked.
- See Also:
- isClickToFocus, setMouseFocus
setMouseFocus
public void setMouseFocus()
- Makes the list request the focus when the mouse enters the list.
- See Also:
- isMouseFocus, setClickToFocus
isDeselectionEnabled
public boolean isDeselectionEnabled()
- Tests if the deselection is enabled when the selection mode is a single
selection.
- See Also:
- setDeselectionEnabled
setDeselectionEnabled
public synchronized void setDeselectionEnabled(boolean b)
- Makes the deselection enabled when the selection mode is a single
selection.
- See Also:
- isDeselectionEnabled
getSelectionMode
public int getSelectionMode()
- Returns the selection mode.
- See Also:
- setSelectionMode, SINGLE_SELECTION, MULTIPLE_SELECTIONS, SHIFT_MULTIPLE_SELECTIONS
setSelectionMode
public synchronized void setSelectionMode(int mode)
- Sets the selection mode.
- See Also:
- getSelectionMode, SINGLE_SELECTION, MULTIPLE_SELECTIONS, SHIFT_MULTIPLE_SELECTIONS
isMultipleMode
public boolean isMultipleMode()
- Determines whether this list allows multiple selections.
- Returns:
-
true
if this list allows multiple selections;
false
otherwise.
- See Also:
- setMultipleMode, getSelectionMode, setSelectionMode
setMultipleMode
public synchronized void setMultipleMode(boolean b)
- Sets the flag that determines whether this list allows multiple
selections.
- Parameters:
- b - if
true
then multiple selections are allowed;
otherwise, only one item from the list can be selected at once.
- See Also:
- isMultipleMode, getSelectionMode, setSelectionMode
getItemCount
public int getItemCount()
- Returns the number of items in the list.
getColumnCount
public int getColumnCount()
- Returns the number of columns in the list.
getItem
public String getItem(int index,
int column)
- Returns the string item associated with the specified index (row)
and column.
getTextItem
public Text getTextItem(int index,
int column)
- Returns the text item associated with the specified index (row)
and column.
setItem
public synchronized void setItem(int index,
int column,
String item)
- Sets the item associated with the specified index (row) and column
to the specified string value.
setItem
public void setItem(int index,
int column,
Text item)
- Sets the item associated with the specified index (row) and column
to the specified text value.
setTextItem
public synchronized void setTextItem(int index,
int column,
Text item)
- Sets the item associated with the specified index (row) and column
to the specified text value.
setItems
public synchronized void setItems(String items[][])
- Sets the items of the list to the specified string row by column items.
setItems
public void setItems(Text items[][])
- Sets the items of the list to the specified text row by column items.
setTextItems
public synchronized void setTextItems(Text items[][])
- Sets the items of the list to the specified text row by column items.
getRowItems
public synchronized String[] getRowItems(int index)
- Returns the string items associated with the specified row index.
getRowTextItems
public Text[] getRowTextItems(int index)
- Returns the text items associated with the specified row index.
getRowItem
public synchronized String getRowItem(int index)
- Returns the item associated with the specified row index.
getRowTextItem
public synchronized Text getRowTextItem(int index)
- Returns the text item associated with the specified row index.
getItems
public synchronized String[] getItems(int column)
- Returns the string items associated with the specified column index.
getTextItems
public Text[] getTextItems(int column)
- Returns the text items associated with the specified column index.
addItem
public void addItem(String item[])
- Adds the specified string row item to the end of the table list.
addItem
public synchronized void addItem(String item[],
int index)
- Adds the specified string row item to the specified row index.
addItem
public void addItem(Text item[])
- Adds the specified text row item to the end of the table list.
addItem
public void addItem(Text item[],
int index)
- Adds the specified text row item to the specified row index.
addTextItem
public void addTextItem(Text item[])
- Adds the specified text row item to the end of the table list.
addTextItem
public synchronized void addTextItem(Text item[],
int index)
- Adds the specified text row item to the specified row index.
replaceItem
public synchronized void replaceItem(String newValue[],
int index)
- Replaces the item at the specified row index with the new strings.
replaceItem
public void replaceItem(Text newValue[],
int index)
- Replaces the item at the specified row index with the new texts.
replaceTextItem
public synchronized void replaceTextItem(Text newValue[],
int index)
- Replaces the item at the specified row index with the new texts.
removeAll
public synchronized void removeAll()
- Removes all items from the list.
- Overrides:
- removeAll in class Container
remove
public void remove(int position)
- Remove the item at the specified row position.
- Overrides:
- remove in class Container
remove
public synchronized void remove(int start,
int end)
- Remove the items at the specified row range.
- Parameters:
- start - the starting row position, inclusive.
- end - the ending row position, inclusive.
remove
public synchronized void remove(int indices[])
- Remove the items at the specified row indices.
- Parameters:
- indices - the row indices to be removed.
removeSelectedIndexes
public synchronized void removeSelectedIndexes()
- Remove the items at the indices of the selected rows.
isIndexSelected
public boolean isIndexSelected(int index)
- Determines if the specified row in this scrolling list is selected.
- Parameters:
- index - the row to be checked.
- Returns:
-
true
if the specified row has been selected;
false
otherwise.
getSelectedIndex
public synchronized int getSelectedIndex()
- Gets the index of the selected row on the list,
- Returns:
- the index of the selected row, or
-1
if no
item is selected, or if more that one row is selected.
getSelectedIndexes
public synchronized int[] getSelectedIndexes()
- Gets the selected row indexes on the list.
- Returns:
- an array of the selected row indexes of this scrolling list.
select
public synchronized void select(int index)
- Selects the row at the specified index in the scrolling list.
- Parameters:
- index - the position of the row to select.
deselect
public synchronized void deselect(int index)
- Deselects the row at the specified index.
If the row at the specified index is not selected, or if the
index is out of range, then the operation is ignored.
- Parameters:
- index - the position of the row to deselect.
getVisibleIndex
public int getVisibleIndex()
- Gets the index of the row that was last made visible by the method
makeVisible
.
- Returns:
- the index of the row that was last made visible.
- See Also:
- makeVisible
makeVisible
public synchronized void makeVisible(int index)
- Makes the row at the specified index visible.
- Parameters:
- index - the position of the row.
- See Also:
- getVisibleIndex
getScrollbarThickness
public int getScrollbarThickness()
- Returns the thickness of the scroll bar.
- See Also:
- setScrollbarThickness
setScrollbarThickness
public synchronized void setScrollbarThickness(int thickness)
- Sets the thickness of the scroll bar.
- See Also:
- setScrollbarThickness
All Packages Class Hierarchy This Package Previous Next Index