|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcharva.awt.Component
charvax.swing.JComponent
charvax.swing.JList
A component that allows the user to select one or more objects from a list.
The JList does not provide scrolling capability. The JList is normally inserted into a JScrollPane to provide scrolling.
| Field Summary | |
protected int |
_currentRow
Offset (from start of list) of the item under the cursor (i.e. |
protected ListModel |
_listModel
The ListModel that holds the items that are displayed by this JList. |
protected ListSelectionModel |
_selectionModel
The ListSelectionModel used by this JList. |
| Fields inherited from class charvax.swing.JComponent |
_border |
| Fields inherited from class charva.awt.Component |
_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Constructor Summary | |
JList()
Constructs a JList with 5 rows, 10 columns wide. |
|
JList(ListModel model_)
Construct a JList that displays the elements in the specified non-null model. |
|
JList(java.lang.Object[] items_)
Construct a JList containing the items in the specified array. |
|
JList(java.util.Vector items_)
Construct a JList containing the items in the specified Vector. |
|
| Method Summary | |
void |
addListSelectionListener(ListSelectionListener il_)
Register an ListSelectionListener object for this component. |
void |
addScrollListener(ScrollListener sl_)
Register a ScrollListener object for this JList. |
void |
addSelectionInterval(int index0_,
int index1_)
Sets the selection to be the set union between the current selection and the specified interval between index0_ and index1_ (inclusive). |
void |
clearSelection()
Clears the selection. |
void |
debug(int level_)
Outputs a textual description of this component to stderr. |
void |
draw()
Draws this component. |
void |
ensureIndexIsVisible(int index_)
Make the specified item visible (by scrolling the list up or down). |
int |
getHeight()
|
int |
getMaxSelectionIndex()
Returns the highest selected item index. |
int |
getMinSelectionIndex()
Returns the lowest selected item index. |
ListModel |
getModel()
Returns the data model that holds the list of items displayed by this JList. |
Dimension |
getPreferredScrollableViewportSize()
Returns the size of the viewport needed to display visibleRows rows. |
int |
getSelectedIndex()
Get the first selected index, or -1 if there is no selected index. |
int[] |
getSelectedIndices()
Returns an array of the selected indices. |
java.lang.Object |
getSelectedValue()
Get the first selected item on this list, or null
if the selection is empty. |
java.lang.Object[] |
getSelectedValues()
Returns an array of the selected values. |
int |
getSelectionMode()
Determines whether this list allows multiple selections. |
ListSelectionModel |
getSelectionModel()
Returns the list's implementation of ListSelectionModel. |
Dimension |
getSize()
|
int |
getVisibleRowCount()
|
int |
getWidth()
|
boolean |
isIndexSelected(int index_)
Determines if the specified item in this scrolling list is selected. |
Dimension |
minimumSize()
Called by LayoutManager. |
void |
processKeyEvent(KeyEvent ke_)
Invoke all the KeyListener callbacks that may have been registered for this component. |
void |
processMouseEvent(MouseEvent e_)
Process a MouseEvent that was generated by clicking the mouse somewhere inside this component. |
void |
processScrollEvent(ScrollEvent e_)
Process scroll events generated by this JList. |
void |
removeListSelectionListener(ListSelectionListener listener_)
Remove the specified ListSelectionListener from the list of listeners that will be notified when the selection changes. |
void |
removeScrollListener(ScrollListener sl_)
Remove a ScrollListener object that is registered for this JList. |
void |
removeSelectionInterval(int index0_,
int index1_)
Sets the selection to be the set difference between the current selection and the specified interval between index0_ and index1_ (inclusive). |
void |
requestFocus()
This method should be invoked by all subclasses of Component which override this method; because this method generates the FOCUS_GAINED event when the component gains the keyboard focus. |
void |
setColumns(int cols_)
Set the number of columns INSIDE the list. |
void |
setListData(java.lang.Object[] listData_)
Constructs a ListModel from an array of Objects and then applies setModel to it. |
void |
setListData(java.util.Vector listData_)
Constructs a ListModel from a Vector and then applies setModel to it. |
void |
setModel(ListModel model_)
Sets the model that represents the "contents" of the list, and clears the selection. |
void |
setSelectedIndex(int index_)
Select the item at the specified index. |
void |
setSelectionMode(int mode_)
Sets the flag that determines whether this list allows multiple selections. |
void |
setSelectionModel(ListSelectionModel model_)
Sets the selection model of the JList to an implementation of the ListSelectionModel interface. |
void |
setVisibleRowCount(int rows_)
Set the maximum number of rows that can be displayed at a time by the JScrollPane which contains this JList. |
| Methods inherited from class charvax.swing.JComponent |
getBorder, getInsets, setBorder |
| Methods inherited from class charva.awt.Component |
addFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, invalidate, isDisplayed, isEnabled, isFocusTraversable, isTotallyObscured, isValid, isVisible, processEvent, processFocusEvent, repaint, requestSync, setBackground, setBounds, setBounds, setBounds, setEnabled, setForeground, setLocation, setLocation, setName, setParent, setVisible, show, validate, validateCursesColor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface charva.awt.Scrollable |
getLocation |
| Field Detail |
protected int _currentRow
protected ListSelectionModel _selectionModel
protected ListModel _listModel
| Constructor Detail |
public JList()
public JList(ListModel model_)
public JList(java.lang.Object[] items_)
public JList(java.util.Vector items_)
| Method Detail |
public void setListData(java.lang.Object[] listData_)
public void setListData(java.util.Vector listData_)
public void setModel(ListModel model_)
public ListModel getModel()
public void setVisibleRowCount(int rows_)
public int getVisibleRowCount()
public void setColumns(int cols_)
public Dimension getSize()
getSize in class Componentpublic int getWidth()
getWidth in class Componentpublic int getHeight()
getHeight in class Componentpublic Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface Scrollablepublic void setSelectionModel(ListSelectionModel model_)
public ListSelectionModel getSelectionModel()
public void addListSelectionListener(ListSelectionListener il_)
public void removeListSelectionListener(ListSelectionListener listener_)
public int getSelectedIndex()
public int[] getSelectedIndices()
public java.lang.Object getSelectedValue()
null
if the selection is empty.
public java.lang.Object[] getSelectedValues()
public void ensureIndexIsVisible(int index_)
public void setSelectedIndex(int index_)
public void addSelectionInterval(int index0_,
int index1_)
public void removeSelectionInterval(int index0_,
int index1_)
public void clearSelection()
isSelectionEmpty()
will return true.
public int getMinSelectionIndex()
public int getMaxSelectionIndex()
public void setSelectionMode(int mode_)
mode_ - the selection mode. Allowed values are:
public int getSelectionMode()
public boolean isIndexSelected(int index_)
public Dimension minimumSize()
minimumSize in class Componentpublic void requestFocus()
Component
requestFocus in class Componentpublic void draw()
draw in class JComponentpublic void processKeyEvent(KeyEvent ke_)
Component
processKeyEvent in class Componentpublic void processMouseEvent(MouseEvent e_)
Component
processMouseEvent in class Componentpublic void addScrollListener(ScrollListener sl_)
addScrollListener in interface Scrollablepublic void removeScrollListener(ScrollListener sl_)
removeScrollListener in interface Scrollablepublic void processScrollEvent(ScrollEvent e_)
processScrollEvent in interface Scrollablepublic void debug(int level_)
debug in class Component
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||