This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes ListSelectionListener and double clicks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ListSelectionListener and double clicks" Watch "ListSelectionListener and double clicks" New topic

ListSelectionListener and double clicks

Kevin Hamrick
Ranch Hand

Joined: Aug 30, 2004
Posts: 32
So here is the code below. The problem is that each time I select a cell from the table the 'else' is executing twice. I am not sure how to fix it. Still new and still struggling with swing,

Kevin Hamrick
Ranch Hand

Joined: Aug 30, 2004
Posts: 32
correction-the "if" is executing twice...I posted some code where I was trying some different mistake. Either way, if I click the selected cell then I get to executions.
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Hi Kevin

See the following code using if(!e.getValueIsAdjusting())
private void jList1_valueChanged(ListSelectionEvent e)
System.out.println("\njList1_valueChanged(ListSelectionEvent e) called.");
Object o = jList1.getSelectedValue();
System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
// TODO: Add any handling code here for the particular object being selected


Download Java GUI Builder, <a href="" target="_blank" rel="nofollow"></a>
subject: ListSelectionListener and double clicks
Similar Threads
Jtable Event Handling
JTable ListSelection problem
JTable Double click
jtable mouse click behaviour
JTable row selection