Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1159
| From | "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Fwd: How do you time rese |
| Message-ID | <1173729511.933376.200980@p10g2000cwp.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:31 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
I tried using a Task class I wrote which extends SwingWorker<Void,
Void>:
Task task = new Task() {
public Void doInBackground() {
SimpleBrowser.this.statusBar.setMessage("Attempting to load " +
SimpleBrowser.this.getURL().toString());
int progress = 0;
//Initialize progress property.
setProgress(0);
while (progress < 10 && !
SimpleBrowser.this.builder.hasLoadedWebpage) {
// SLEEP FOR 1 SECOND
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {}
progress++;
setProgress(Math.min(progress, 10));
}
SimpleBrowser.this.setWebBrowserURL();
return null;
}
public void done() {
SimpleBrowser.this.statusBar.setMessage("Done");
}
};
task.addPropertyChangeListener(SimpleBrowser.this);
task.execute();
Problem is now that it will do the following:
1) Show status of "Attempting to load.."
2) Show status of "Done"
3) Load the page into JEditorPane
The order I want is this:
1) Show status of "Attempting to load.."
2) Load the page into JEditorPane
3) Show status of "Done"
How do I accomplish this?
Phil
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar | Unroll thread
Fwd: How do you time rese "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000 Re: Fwd: How do you time "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
csiph-web