Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show status problem

Status
Not open for further replies.

kohinoor2007

Programmer
Mar 21, 2007
69
DE
Hi all,

Iam developing a client applet under java.My class extends from JApplet.

Have run into a problem in which the "showstatus" method is not displaying anything on the browser status bar.



My code is as follows:

private void loadInitialData(){

Runnable worker =new Runnable(){

public void run(){

waitUntilConnected();
try{

showStatus("STATUSMESSAGE");
//A Time consuming methid is called from here.TimeConsumingMethod();
showStatus("Ready");


}
catch(Exception error){
showError("Failed,error);

}
}
};

SwingUtilities.invokeLater(worker);

}


"loadInitialData" method is called from the "init" function of the applet. I have some restrictions,for which I have to use the runnable thread.

How can I make the "showstatus" work from within the thread....

Thanks in advance....
 
You may need to do this to access the method...
Code:
YourAppletClassName.this.showStatus("STATUSMESSAGE");

Tim
 
Well, can you expand on 'Not Working'. It's not a lot to go on is it?

Tim
 
The places in the above posted code ,I added

MyApplet.this.showStatus("STATUSMESSAGE");

But still the message is not appearing on the status bar...
 
You don't specify neither the error you're getting nor what showStatus is doing ...

Cheers,
Dian
 
There is no exception thrown or error.The status bar always shows the "ready" string & not my string which is passed with the showstatus method.
 
Did you have a look at the console? What does the showStatus do? How did you implement it?

Cheers,
Dian
 
Have you tried using an alternative browser?

Tim
 
You said you extended JApplet, I cannot know it you overrided showStatus ...

Is the thread being executed? And the method? Maybe it's hanging in the wait call.

Did you try more than one browser?

Cheers,
Dian
 

Yeah,May be its hanging in the wait call....I think so too...
Any way to get around it...

No,Didnt try with other browsers.
 
You're a little bit hard to help ...

What's the wait method doing? What about including some System.out to see where is it stopping?

Cheers,
Dian
 

:).Okay Diancecht.Will try out those things...
Thanks for the support...
 
I would put a breakpoint at waitUntilConnected() to see if the program ever reaches your try block.
 
A breakpoint in an applet? I'm not sure that can be done.

Cheers,
Dian
 
He's been asked to try it in a different browser twice and we STILL don't know if he's done this or what the results were. I'd wait to see if it's a browser compatibility issue before even suggesting trying to remote debug an applet (which I'd assume is theoretically possible since there is a JVM involved).

Tim
 

Solved the problem by removing the " showStatus("STATUSMESSAGE"); " from my above posted code and putting it directly under the "init" function,but calling it in a different thread by using

javax.swing.SwingUtilities.invokeAndWait(new Runnable()) method.

Thanks for all the support...
 
So that means the wait call was waiting too much or the non-AWT thread was busy. Anyway, I'd be careful with that invokeLater/invokeAndWait stuff: it's hard to understand and almost imposible to debug if there are problems.

I'm still curious about the breakpoint in an applet ...

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top