Starnge swing problem

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 59
Reputation: Chaster is an unknown quantity at this point 
Solved Threads: 3
Chaster Chaster is offline Offline
Junior Poster in Training

Starnge swing problem

 
0
  #1
Sep 7th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 13
Reputation: msi_333 is an unknown quantity at this point 
Solved Threads: 1
msi_333's Avatar
msi_333 msi_333 is offline Offline
Newbie Poster

Re: Starnge swing problem

 
0
  #2
Sep 7th, 2009
Swing lib use threading to Draw as you may knew , can you please post the code .
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 59
Reputation: Chaster is an unknown quantity at this point 
Solved Threads: 3
Chaster Chaster is offline Offline
Junior Poster in Training

Re: Starnge swing problem

 
0
  #3
Sep 7th, 2009
Originally Posted by msi_333 View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 332
Reputation: quuba is on a distinguished road 
Solved Threads: 53
quuba quuba is offline Offline
Posting Whiz

Re: Starnge swing problem

 
0
  #4
Sep 7th, 2009
1.What about model of JList?
2.Forced repaint() method?
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 59
Reputation: Chaster is an unknown quantity at this point 
Solved Threads: 3
Chaster Chaster is offline Offline
Junior Poster in Training

Re: Starnge swing problem

 
0
  #5
Sep 7th, 2009
Originally Posted by quuba View Post
1.What about model of JList?
2.Forced repaint() method?
1.) Default
2.) Repainted after each update
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 332
Reputation: quuba is on a distinguished road 
Solved Threads: 53
quuba quuba is offline Offline
Posting Whiz

Re: Starnge swing problem

 
0
  #6
Sep 7th, 2009
Your code looks like this?
JList list;
/////
DefaultListModel model = new DefaultListModel();
list = new JList(model) ;
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC