public class ListItemMouseAdapter extends MouseAdapter
MouseAdapter
for handling single-
and double-clicks on items in a JList
.
The following example illustrates how this adapter might be used:
list.addMouseListener(new ListItemMouseAdapter() { public void itemClicked(int item, int button) { System.out.println("Button " + button + " clicked on item #" + item); } });
Constructor and Description |
---|
ListItemMouseAdapter()
Construct a new
ListItemMouseAdapter . |
Modifier and Type | Method and Description |
---|---|
void |
itemClicked(int item,
int button)
Handle a single-click on an item.
|
void |
itemDoubleClicked(int item,
int button)
Handle a double-click on an item.
|
void |
mouseClicked(MouseEvent evt)
Handle a mouse event.
|
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
public ListItemMouseAdapter()
ListItemMouseAdapter
.public final void mouseClicked(MouseEvent evt)
JList
; if it is not,
the event is ignored.mouseClicked
in interface MouseListener
mouseClicked
in class MouseAdapter
evt
- The event.public void itemClicked(int item, int button)
item
- The index of the item that was clicked on.button
- The mouse button that was clicked.public void itemDoubleClicked(int item, int button)
item
- The index of the item that was clicked on.button
- The mouse button that was clicked.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses