You need to respect the fact that Swing is single threaded.
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
For simple cases, you don't need to introduce a worker thread as mentioned in the above article.
Just be sure to have all UI operations wrapped in Runnables and use InvokeLater to get them to
execute on the AWT thread.
This simple change should do what you want:
protected class SCDThread extends Thread{
public SCDThread(){}
public void run(){
/* method that gets all data and has ProgressMonitor initialized and updated */
scr.addSizeChainScreen();
// update the UI when done.
// Note: if your progress monitor updates are also done correctly
// you probably won't need the extra repaint() call you had here
SwingUtils.invokeLater(new Runnable() {
public void run() {
screens.setSelectedIndex(5);
}
}
}
}
~rmp
-----Original Message-----
From: Aleksandr Kravets [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 9:52 AM
To: [EMAIL PROTECTED]
Subject: JTabbedPane problem
Hello,
I have a JTabbedPane in which when I click a specific tab I launch
ProgressMonitor that shows progress of file that is being read. After
ProgressMonitor closes, focus on the tab screen is gained, but everything in
it is not showing (blank screen). Only after I click inside the screen will
I see what's in there. Does anyone have any suggestions?
code:
protected class SCDThread extends Thread{
public SCDThread(){}
public void run(){
/*
method that gets all data and has
ProgressMonitor
initialized and updated
*/
scr.addSizeChainScreen();
screen6.repaint();
screens.setSelectedIndex(5);
}
}
thanks,
Alex
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing