• Post Reply Bookmark Topic Watch Topic
  • New Topic

arrow-down and arrow-up stop working in JList

 
Howard Zhao
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
In my application, I have two lists (Jlist masterList, JList slaveList) and 9 JComboBoxes.
When an item in masterList is selected, the data in slaveList is updated as well, then data in JComboBoxes is updated consequently.
What I do is
if an item in masterList is selected, I will set slaveList.setSelectedIndex(0), in slaveList's valueChanged(ListSelectionEvent e) method I update data in JComboBoxes.
The problem I have now is that since it takes quite a while to update slaveList when an item in masterList is selected (the new data in slaveList has to be fetched from a servlet in an independent thread),, when arrow-down or arrow-up is kept pressed, after several updates, the masterList stops responding, (Of course, after JComboBoxes are updated, masterList
is the focus owner), but page-up and page-down work well.
Both lists are set setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
Any idears?
Thanx.
howard
 
Tamizh Selvan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem as u mentioned is due to the delay in fetching the data. so better remove the seletionlistener and have a seperate button to update the slavelist and other combo boxes.
or once an item is selected in the master list make it disabled untill the form is updated with the latest values.
Hope this would work.
Marcus
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you get all the data needed in that screen from the database in XML form or in ValueObjects when the screen is loaded.
This will reduce the n/w traffic, and tunes the performance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!