Forum Stats

  • 3,838,776 Users
  • 2,262,398 Discussions
  • 7,900,755 Comments

Discussions

Unable to select/deselect items in a JList while it is performing some task

832023
832023 Member Posts: 1
edited Jan 28, 2011 12:25AM in Java Programming
Hi,
I am using JList to show some data in JScrollPane.If I am selecting some items from the JList to perform some task I am unable to deselect them or select any other items from the JList until the completion of the task .

I want to deselect selected items or select the other items to perform some other task before completion of the 1st task.

I am using swing,awt in my code to develop the GUI.I tried by creating child thread todeslect the items,but unable to deselect.

Can any one help me how can I use the JList items to perform some other task before comletion of the 1st task.
Tagged:

Answers

  • Kayaman
    Kayaman Member Posts: 3,844 Silver Trophy
    user13778820 wrote:
    Hi,
    I am using JList to show some data in JScrollPane.If I am selecting some items from the JList to perform some task I am unable to deselect them or select any other items from the JList until the completion of the task .
    You're using the event thread to perform your task. That means the graphical user interface can't run while your task is running.
    Look at the SwingWorker class, it was pretty much designed for this kind of thing.
    I am using swing,awt in my code to develop the GUI.
    You're using both swing and awt? It's not recommended to mix Swing and AWT code together.
This discussion has been closed.