Example usage for Java javax.swing JList fields, constructors, methods, implement or subclass
The text is from its open source code.
int | VERTICAL Indicates a vertical layout of cells, in a single column; the default layout. |
int | VERTICAL_WRAP Indicates a "newspaper style" layout with cells flowing vertically then horizontally. |
int | HORIZONTAL_WRAP Indicates a "newspaper style" layout with cells flowing horizontally then vertically. |
JList() Constructs a JList with an empty, read-only, model. | |
JList(ListModel Constructs a JList that displays elements from the specified, non-null , model. | |
JList(final E[] listData) Constructs a JList that displays the elements in the specified array. | |
JList(final Vector extends E> listData) Constructs a JList that displays the elements in the specified Vector . |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addListSelectionListener(ListSelectionListener listener) Adds a listener to the list, to be notified each time a change to the selection occurs; the preferred way of listening for selection state changes. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addSelectionInterval(int anchor, int lead) Sets the selection to be the union of the specified interval with current selection. |
void | clearSelection() Clears the selection; after calling this method, isSelectionEmpty will return true . |
void | ensureIndexIsVisible(int index) Scrolls the list within an enclosing viewport to make the specified cell completely visible. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
int | getAnchorSelectionIndex() Returns the anchor selection index. |
Color | getBackground() Gets the background color of this component. |
Rectangle | getCellBounds(int index0, int index1) Returns the bounding rectangle, in the list's coordinate system, for the range of cells specified by the two indices. |
ListCellRenderer super E> | getCellRenderer() Returns the object responsible for painting list items. |
Object | getClientProperty(Object key) Returns the value of the property with the specified key. |
boolean | getDragEnabled() Returns whether or not automatic drag handling is enabled. |
DropLocation | getDropLocation() Returns the location that this component should visually indicate as the drop location during a DnD operation over the component, or null if no location is to currently be shown. |
int | getFirstVisibleIndex() Returns the smallest list index that is currently visible. |
int | getFixedCellHeight() Returns the value of the fixedCellHeight property. |
int | getFixedCellWidth() Returns the value of the fixedCellWidth property. |
Font | getFont() Gets the font of this component. |
Color | getForeground() Gets the foreground color of this component. |
InputMap | getInputMap(int condition) Returns the InputMap that is used during condition . |
int | getLastVisibleIndex() Returns the largest list index that is currently visible. |
int | getLayoutOrientation() Returns the layout orientation property for the list: VERTICAL if the layout is a single column of cells, VERTICAL_WRAP if the layout is "newspaper style" with the content flowing vertically then horizontally, or HORIZONTAL_WRAP if the layout is "newspaper style" with the content flowing horizontally then vertically. |
int | getLeadSelectionIndex() Returns the lead selection index. |
ListSelectionListener[] | getListSelectionListeners() Returns an array of all the ListSelectionListener s added to this JList by way of addListSelectionListener . |
int | getMaxSelectionIndex() Returns the largest selected cell index, or -1 if the selection is empty. |
int | getMinSelectionIndex() Returns the smallest selected cell index, or -1 if the selection is empty. |
ListModel | getModel() Returns the data model that holds the list of items displayed by the JList component. |
int | getNextMatch(String prefix, int startIndex, Position.Bias bias) Returns the next list element whose toString value starts with the given prefix. |
Dimension | getPreferredScrollableViewportSize() Computes the size of viewport needed to display visibleRowCount rows. |
Dimension | getPreferredSize() If the preferredSize has been set to a non-null value just returns it. |
E | getPrototypeCellValue() Returns the "prototypical" cell value -- a value used to calculate a fixed width and height for cells. |
int | getSelectedIndex() Returns the smallest selected cell index; the selection when only a single item is selected in the list. |
int[] | getSelectedIndices() Returns an array of all of the selected indices, in increasing order. |
E | getSelectedValue() Returns the value for the smallest selected cell index; the selected value when only a single item is selected in the list. |
Object[] | getSelectedValues() Returns an array of all the selected values, in increasing order based on their indices in the list. |
List | getSelectedValuesList() Returns a list of all the selected items, in increasing order based on their indices in the list. |
Color | getSelectionBackground() Returns the color used to draw the background of selected items. |
Color | getSelectionForeground() Returns the color used to draw the foreground of selected items. |
int | getSelectionMode() Returns the current selection mode for the list. |
ListSelectionModel | getSelectionModel() Returns the current selection model. |
int | getVisibleRowCount() Returns the value of the visibleRowCount property. |
Point | indexToLocation(int index) Returns the origin of the specified item in the list's coordinate system. |
boolean | isEnabled() Determines whether this component is enabled. |
boolean | isSelectedIndex(int index) Returns true if the specified index is selected, else false . |
boolean | isSelectionEmpty() Returns true if nothing is selected, else false . |
boolean | isShowing() Determines whether this component is showing on screen. |
boolean | isVisible() Determines whether this component should be visible when its parent is visible. |
int | locationToIndex(Point location) Returns the cell index closest to the given location in the list's coordinate system. |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | removeListSelectionListener(ListSelectionListener listener) Removes a selection listener from the list. |
void | removeSelectionInterval(int index0, int index1) Sets the selection to be the set difference of the specified interval and the current selection. |
void | repaint(Rectangle r) Adds the specified region to the dirty region list if the component is showing. |
void | repaint() Repaints this component. |
void | requestFocus() Requests that this Component gets the input focus. |
boolean | requestFocusInWindow() Requests that this Component gets the input focus. |
void | revalidate() Supports deferred automatic layout. |
void | scrollRectToVisible(Rectangle aRect) Forwards the scrollRectToVisible() message to the JComponent 's parent. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setCellRenderer(ListCellRenderer super E> cellRenderer) Sets the delegate that is used to paint each cell in the list. |
void | setComponentPopupMenu(JPopupMenu popup) Sets the JPopupMenu for this JComponent . |
void | setDragEnabled(boolean b) Turns on or off automatic drag handling. |
void | setDropMode(DropMode dropMode) Sets the drop mode for this component. |
void | setEnabled(boolean enabled) Sets whether or not this component is enabled. |
void | setFixedCellHeight(int height) Sets a fixed value to be used for the height of every cell in the list. |
void | setFixedCellWidth(int width) Sets a fixed value to be used for the width of every cell in the list. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setLayoutOrientation(int layoutOrientation) Defines the way list cells are layed out. |
void | setListData(final E[] listData) Constructs a read-only ListModel from an array of items, and calls setModel with this model. |
void | setListData(final Vector extends E> listData) Constructs a read-only ListModel from a Vector and calls setModel with this model. |
void | setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value. |
void | setModel(ListModel Sets the model that represents the contents or "value" of the list, notifies property change listeners, and then clears the list's selection. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setPrototypeCellValue(E prototypeCellValue) Sets the prototypeCellValue property, and then (if the new value is non-null ), computes the fixedCellWidth and fixedCellHeight properties by requesting the cell renderer component for the given value (and index 0) from the cell renderer, and using that component's preferred size. |
void | setSelectedIndex(int index) Selects a single cell. |
void | setSelectedIndices(int[] indices) Changes the selection to be the set of indices specified by the given array. |
void | setSelectedValue(Object anObject, boolean shouldScroll) Selects the specified object from the list. |
void | setSelectionBackground(Color selectionBackground) Sets the color used to draw the background of selected items, which cell renderers can use fill selected cells. |
void | setSelectionForeground(Color selectionForeground) Sets the color used to draw the foreground of selected items, which cell renderers can use to render text and graphics. |
void | setSelectionInterval(int anchor, int lead) Selects the specified interval. |
void | setSelectionMode(int selectionMode) Sets the selection mode for the list. |
void | setSelectionModel(ListSelectionModel selectionModel) Sets the selectionModel for the list to a non-null ListSelectionModel implementation. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(TransferHandler newHandler) Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop. |
void | setUI(ListUI ui) Sets the ListUI , the look and feel object that renders this component. |
void | setValueIsAdjusting(boolean b) Sets the selection model's valueIsAdjusting property. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | setVisibleRowCount(int visibleRowCount) Sets the visibleRowCount property, which has different meanings depending on the layout orientation: For a VERTICAL layout orientation, this sets the preferred number of rows to display without requiring scrolling; for other orientations, it affects the wrapping of cells. |
void | updateUI() Resets the ListUI property by setting it to the value provided by the current look and feel. |