getSelectedIndex
getSelectedIndex: (JList) -> numberThe first selected row, or -1.
JList.new(…)| Method | Returns | Description |
|---|---|---|
getSelectedIndex() | number | The first selected row, or -1. |
setSelectedIndex(number) | () | Selects that row alone; a row at or past the model's size, or -1, does nothing. Below -1 raises. |
getSelectedIndices() | {number} | The selected rows, in increasing order (0-based). |
setSelectedIndices({number}) | () | Selects these rows (those at or past the model's size are ignored). |
isSelectedIndex(number) | boolean | Whether index is selected. |
isSelectionEmpty() | boolean | Whether nothing is selected. |
clearSelection() | () | Selects nothing; the lead and anchor stay. |
getMinSelectionIndex() | number | The smallest selected row, or -1. |
getMaxSelectionIndex() | number | The largest selected row, or -1. |
getLeadSelectionIndex() | number | The row the last selection change ended at, or -1. |
getAnchorSelectionIndex() | number | The row the last selection change started from, or -1. |
setSelectionInterval(number, number) | () | Selects the rows index0 to index1 (only index1 in SINGLE_SELECTION). |
addSelectionInterval(number, number) | () | Adds the rows index0 to index1 to the selection. |
removeSelectionInterval(number, number) | () | Removes the rows index0 to index1 from the selection. |
setSelectionMode(number) | () | ListSelectionModel.SINGLE_SELECTION (0), SINGLE_INTERVAL_SELECTION (1) or MULTIPLE_INTERVAL_SELECTION (2, a new list's); any other ra… |
getSelectionMode() | number | The selection mode. |
setValueIsAdjusting(boolean) | () | Starts (true) or ends (false) one gesture of selection changes: its events say they are adjusting, and the end fires once more over eve… |
getValueIsAdjusting() | boolean | Whether a gesture is in progress. |
setFixedCellHeight(number) | () | Every cell this tall (-1: each row's renderer decides). |
getFixedCellHeight() | number | The fixed cell height, or -1. |
setFixedCellWidth(number) | () | Every cell this wide (-1: the widest row's renderer decides). |
getFixedCellWidth() | number | The fixed cell width, or -1. |
setLayoutOrientation(number) | () | JList.VERTICAL (0), VERTICAL_WRAP (1) or HORIZONTAL_WRAP (2); any other raises. The wrapping orientations lay out as VERTICAL in Be… |
getLayoutOrientation() | number | The orientation. |
setVisibleRowCount(number) | () | How many rows a scroll pane shows of it by default (8). |
getVisibleRowCount() | number | The visible row count. |
locationToIndex(Point) | number | The row closest to location (in the list's coordinates), or -1 when the model is empty; compare with getCellBounds to know whether the… |
indexToLocation(number) | Point? | The origin of row index's cell, or nil outside the model. |
getCellBounds(number, number) | Rectangle? | The bounds of the cells of rows index0 to index1 (their union), or nil when either row is outside the model. |
ensureIndexIsVisible(number) | () | Scrolls the enclosing scroll pane so row index's cell shows. |
getFirstVisibleIndex() | number | The first row showing, or -1. |
getLastVisibleIndex() | number | The last row showing, or -1. |
setCellRenderer(any) | () | Paints each cell with cellRenderer (a ListCellRenderer: a table with `getListCellRendererComponent(list, value, index, isSelected, cell… |
getCellRenderer() | ListCellRenderer? | The renderer setCellRenderer was given, or nil for the default one. |
addListSelectionListener(any) | () | Adds a ListSelectionListener (a table with valueChanged, or that function): it hears each selection change, the last added first; its e… |
removeListSelectionListener(any) | () | Removes a ListSelectionListener, by identity. |
getListSelectionListeners() | {any} | The ListSelectionListeners, in registration order. |
getModel() | any | The model given, or JList()'s empty one. |
getSelectedValue() | any | The model's element at the first selected row, or nil. |
setModel(any) | () | Shows model and clears the selection; nil raises. |
new(any) | JList | () -> JList: An empty list (its model getModel() answers, empty and read-only). |
init(JList, any) | () | (JList) -> (): An empty list (its model getModel() answers, empty and read-only). |
isInstance(any) | boolean | Whether obj is a JList object, a class(JList) subclass's included. |
| Field | Type | Description |
|---|---|---|
VERTICAL | number | JList.VERTICAL: the vertical orientation, one column of rows (0). |
VERTICAL_WRAP | number | JList.VERTICAL_WRAP (1): laid out as VERTICAL. |
HORIZONTAL_WRAP | number | JList.HORIZONTAL_WRAP (2): laid out as VERTICAL. |
super | JComponentClass | JComponent's class table: the base class. |
| Method | Returns | Description |
|---|---|---|
JListClass.new | JList | () -> JList: An empty list (its model getModel() answers, empty and read-only). |
getSelectedIndexgetSelectedIndex: (JList) -> numberThe first selected row, or -1.
setSelectedIndexsetSelectedIndex: (JList, number) -> ()Selects that row alone; a row at or past the model's size, or -1, does nothing. Below -1 raises.
getSelectedIndicesgetSelectedIndices: (JList) -> {number}The selected rows, in increasing order (0-based).
setSelectedIndicessetSelectedIndices: (JList, {number}) -> ()Selects these rows (those at or past the model's size are ignored).
isSelectedIndexisSelectedIndex: (JList, number) -> booleanWhether index is selected.
isSelectionEmptyisSelectionEmpty: (JList) -> booleanWhether nothing is selected.
clearSelectionclearSelection: (JList) -> ()Selects nothing; the lead and anchor stay.
getMinSelectionIndexgetMinSelectionIndex: (JList) -> numberThe smallest selected row, or -1.
getMaxSelectionIndexgetMaxSelectionIndex: (JList) -> numberThe largest selected row, or -1.
getLeadSelectionIndexgetLeadSelectionIndex: (JList) -> numberThe row the last selection change ended at, or -1.
getAnchorSelectionIndexgetAnchorSelectionIndex: (JList) -> numberThe row the last selection change started from, or -1.
setSelectionIntervalsetSelectionInterval: (JList, number, number) -> ()Selects the rows index0 to index1 (only index1 in SINGLE_SELECTION).
addSelectionIntervaladdSelectionInterval: (JList, number, number) -> ()Adds the rows index0 to index1 to the selection.
removeSelectionIntervalremoveSelectionInterval: (JList, number, number) -> ()Removes the rows index0 to index1 from the selection.
setSelectionModesetSelectionMode: (JList, number) -> ()ListSelectionModel.SINGLE_SELECTION (0), SINGLE_INTERVAL_SELECTION (1) or MULTIPLE_INTERVAL_SELECTION (2, a new list's); any other raises.
getSelectionModegetSelectionMode: (JList) -> numberThe selection mode.
setValueIsAdjustingsetValueIsAdjusting: (JList, boolean) -> ()Starts (true) or ends (false) one gesture of selection changes: its events say they are adjusting, and the end fires once more over every row it changed.
getValueIsAdjustinggetValueIsAdjusting: (JList) -> booleanWhether a gesture is in progress.
setFixedCellHeightsetFixedCellHeight: (JList, number) -> ()Every cell this tall (-1: each row's renderer decides).
getFixedCellHeightgetFixedCellHeight: (JList) -> numberThe fixed cell height, or -1.
setFixedCellWidthsetFixedCellWidth: (JList, number) -> ()Every cell this wide (-1: the widest row's renderer decides).
getFixedCellWidthgetFixedCellWidth: (JList) -> numberThe fixed cell width, or -1.
setLayoutOrientationsetLayoutOrientation: (JList, number) -> ()JList.VERTICAL (0), VERTICAL_WRAP (1) or HORIZONTAL_WRAP (2); any other raises. The wrapping orientations lay out as VERTICAL in Bento.
getLayoutOrientationgetLayoutOrientation: (JList) -> numberThe orientation.
setVisibleRowCountsetVisibleRowCount: (JList, number) -> ()How many rows a scroll pane shows of it by default (8).
getVisibleRowCountgetVisibleRowCount: (JList) -> numberThe visible row count.
locationToIndexlocationToIndex: (JList, Point) -> numberThe row closest to location (in the list's coordinates), or -1 when the model is empty; compare with getCellBounds to know whether the row holds it.
indexToLocationindexToLocation: (JList, number) -> Point?The origin of row index's cell, or nil outside the model.
getCellBoundsgetCellBounds: (JList, number, number) -> Rectangle?The bounds of the cells of rows index0 to index1 (their union), or nil when either row is outside the model.
ensureIndexIsVisibleensureIndexIsVisible: (JList, number) -> ()Scrolls the enclosing scroll pane so row index's cell shows.
getFirstVisibleIndexgetFirstVisibleIndex: (JList) -> numberThe first row showing, or -1.
getLastVisibleIndexgetLastVisibleIndex: (JList) -> numberThe last row showing, or -1.
setCellRenderersetCellRenderer: (JList, any) -> ()Paints each cell with cellRenderer (a ListCellRenderer: a table with getListCellRendererComponent(list, value, index, isSelected, cellHasFocus), or that function), asked again when the list repaints or measures its cells, never per frame; nil is the default renderer (a label of the value's text).
getCellRenderergetCellRenderer: (JList) -> ListCellRenderer?The renderer setCellRenderer was given, or nil for the default one.
addListSelectionListeneraddListSelectionListener: (JList, any) -> ()Adds a ListSelectionListener (a table with valueChanged, or that function): it hears each selection change, the last added first; its events' source is the list.
removeListSelectionListenerremoveListSelectionListener: (JList, any) -> ()Removes a ListSelectionListener, by identity.
getListSelectionListenersgetListSelectionListeners: (JList) -> {any}The ListSelectionListeners, in registration order.
getModelgetModel: (JList) -> anyThe model given, or JList()'s empty one.
getSelectedValuegetSelectedValue: (JList) -> anyThe model's element at the first selected row, or nil.
setModelsetModel: (JList, any) -> ()Shows model and clears the selection; nil raises.
newnew: (any) -> JList() -> JList: An empty list (its model getModel() answers, empty and read-only).
(any) -> JList: A list showing dataModel: a DefaultListModel, or a plugin's model (an AbstractListModel subclass with getSize and getElementAt). nil is refused.
initinit: (JList, any) -> ()(JList) -> (): An empty list (its model getModel() answers, empty and read-only).
(JList, any) -> (): A list showing dataModel: a DefaultListModel, or a plugin's model (an AbstractListModel subclass with getSize and getElementAt). nil is refused.
isInstanceisInstance: (any) -> booleanWhether obj is a JList object, a class(JList) subclass's included.