Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList - Where was I?  RSS feed

 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JList that shows tables names from my database. Also on the screen are some check boxes that will be used to grant permissions for the tables - select, update etc.
When the user selects an item in the list, the check boxes are refreshed to show current status.
What I want to do is save new values of the check boxes when the user moves to a different item in the list. My problem is I don't know what item the user was last on.
I'm trying to catch this is the valueChanged() method. getSelectedValue() returns the new selection. Is there a way to trap the selected item right before it is no longer selected? I've been through the API but can't find anything.
Thanks,
Michael
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,
I feel you can do it like this.
String prevTable = null;
public void valueChanged(ChangeEvent ce)
{
if(prevTable==null)
{
prevTable = list.getSelectedItem();
}
else
{
// update the permissions for the prev table.
......
prevTable = prevTable = list.getSelectedItem();

}

}
hope this solves your problem
regards
deekasha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!