943,799 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 412
  • Java RSS
Sep 7th, 2009
0

Starnge swing problem

Expand Post »
Hello guys,

I don't really need a solution, just answer - some Swing insight. So I have a panel, and a list on it. The list is populated with strings. The problem is the following: If I add the list elements too fast, I end up with different kinds of strange windows. However, after introducing a sleep(100), or another function call, it surprisingly works fine. I didn't believe this was the problem, so I added and removed the sleep several times. It solved the glitch 10/10.

How? Why? Ideas and guessings are welcome as well.

Thanks in advance,
Chaster
Last edited by Chaster; Sep 7th, 2009 at 2:31 pm.
Similar Threads
Reputation Points: 12
Solved Threads: 3
Junior Poster in Training
Chaster is offline Offline
68 posts
since Jun 2007
Sep 7th, 2009
0

Re: Starnge swing problem

Swing lib use threading to Draw as you may knew , can you please post the code .
Reputation Points: 10
Solved Threads: 4
Newbie Poster
msi_333 is offline Offline
22 posts
since Jun 2007
Sep 7th, 2009
0

Re: Starnge swing problem

Click to Expand / Collapse  Quote originally posted by msi_333 ...
Swing lib use threading to Draw as you may knew , can you please post the code .
It's kind of confidential. I just hoped someone came across the same issue . Actually it's nothing special about the code. It's not multi-threaded, I just add several entries to the list.
Reputation Points: 12
Solved Threads: 3
Junior Poster in Training
Chaster is offline Offline
68 posts
since Jun 2007
Sep 7th, 2009
0

Re: Starnge swing problem

1.What about model of JList?
2.Forced repaint() method?
Reputation Points: 123
Solved Threads: 106
Posting Pro
quuba is offline Offline
573 posts
since Nov 2008
Sep 7th, 2009
0

Re: Starnge swing problem

Click to Expand / Collapse  Quote originally posted by quuba ...
1.What about model of JList?
2.Forced repaint() method?
1.) Default
2.) Repainted after each update
Reputation Points: 12
Solved Threads: 3
Junior Poster in Training
Chaster is offline Offline
68 posts
since Jun 2007
Sep 7th, 2009
0

Re: Starnge swing problem

Your code looks like this?
JList list;
/////
DefaultListModel model = new DefaultListModel();
list = new JList(model) ;
Reputation Points: 123
Solved Threads: 106
Posting Pro
quuba is offline Offline
573 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Newbie need help with threading
Next Thread in Java Forum Timeline: Java beginner





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC