org.grinvin.gui
Class DropList
public class DropList
extends JList
Extension to JList
which enables dropping at
positions between list elements and indicates the drop
position by means of a horizontal cursor.
protected int | cursorMargin - Extra vertical space to be left on top of the list and at the bottom
to make sure the cursor is fully visible when drawn at both extremes
of the list.
|
DropList(ListModel dataModel) - Construct a list of this type for a given data model.
|
int | getCursorIndex() - Return the position at which the cursor is drawn.
|
protected void | paintCursor(Graphics g, int index) - Paint the cursor at the given position.
|
protected void | paintCursor(Graphics g, int x, int y, int width) - Draw a cursor at the given position.
|
void | setCursorIndex(Point location) - Set the cursor index according to the given location.
|
void | setCursorIndex(int index) - Set the position at which the cursor should be drawn.
|
protected @Override | void paintComponent(Graphics g)
|
cursorMargin
protected int cursorMargin
Extra vertical space to be left on top of the list and at the bottom
to make sure the cursor is fully visible when drawn at both extremes
of the list.
DropList
public DropList(ListModel dataModel)
Construct a list of this type for a given data model.
getCursorIndex
public int getCursorIndex()
Return the position at which the cursor is drawn.
paintCursor
protected void paintCursor(Graphics g,
int index)
Paint the cursor at the given position.
paintCursor
protected void paintCursor(Graphics g,
int x,
int y,
int width)
Draw a cursor at the given position.
g
- graphics contextx
- X-position of the cursory
- Y-position of the left side of the cursorwidth
- Width of the cursor
setCursorIndex
public void setCursorIndex(Point location)
Set the cursor index according to the given location.
setCursorIndex
public void setCursorIndex(int index)
Set the position at which the cursor should be drawn.
index
- Index of the list element in front of which the cursor should
be drawn. If out of range, the cursor will not be drawn.
void paintComponent
protected @Override void paintComponent(Graphics g)