[EMAIL PROTECTED] schrieb:
> In wrote a Java 2 application (in fact a JPanel) collection some info from CD's
>(title, path, zippath, filename) and record this info into a MS Access database. No
>problem ...
>
> Afterwards I changed the application by adding some feedback (nb dirs/files) by
>adding a Thread
> try {
> engine.sleep(1000);
> catch (...) { }
> tfCount.setText(...);
> this.repaint();
> but the JP�nel is not repainted ...
I assume, that you use a separate thread for this. But Swing is (mostly)
single-threaded.
That means, JComponents should only be manipulated from the AWT Eventqueue.
> The only way to get feedback is replacing the "repaint"-statement by
> Graphics g = this.getGraphics();
> this.paint(g);
> Is this the right way - or - how can repaint the JPanel by the "repaint"-statement ?
The right way (tm) is to put every modification from another Thread
into the AWT Eventqueue. Fortunately, there is a helper for this:
SwingUtilities.invokeLater(new Runnable() {
public void run() {
tfCount.setText(...);
}
});
That should do it.
--
Christian Pesch - Software Engineer
CoreMedia AG - http://www.coremedia-ag.com - 0700-COREMEDIA
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing