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

to add element to a jList  RSS feed

 
Gayani Kanchana
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add and display item one by one when a button is clicked since i am using jlist to show error messages according to functions i called inside the click event of the jbutton.however my list get populated all at once after i called the all the functions inside click event.please help me by giving instructions.

thanks a lot
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not clear on what you're trying to do.

- a button is clicked
- some action is taken which leads to error messages being generated
- the error messages are listed in a JList, all at once
- you do not want them to be added all at once, but rather one by one

Which leads to the question: After the first error is added, what needs to happen until the second one is added - some amount of time passes or some user action? You would need to store all the error messages in some data structure, so that you can add them as appropriate.
[ March 28, 2007: Message edited by: Ulf Dittmer ]
 
Ricky Clarkson
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are working on the Event Dispatch Thread, the thread that handles all UI stuff, then don't do anything that takes any measurable amount of time.

If you need to do something that takes any measurable amount of time, such as I/O, use SwingWorker to do it. That way your GUI will get the attention from the EDT it deserves, rather than the EDT being locked up trying to access files.

By the way, I don't do as I preach here, which is why when loading a file in my network simulator there is up to 2 seconds of non-responsiveness.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!