Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2008, 10:13 PM
Member
 
Join Date: May 2008
Posts: 7
olbion is on a distinguished road
Debugging an applet - lost for solutions
I have an applet which sometimes freezes and I'm trying to find out why.

In Linux, I've located the problem to disabling a button. More precisely, Canvas.setEnabled(false). If I comment that out, the applet runs ok (but the button is still active of course, which it is not supposed to be).

When I run the same applet in Internet Explorer, it freezes anyhow, whether or not the button is disabled. The applet window freezes, as does the console (to which no error message is written) and the browser.

In no case does the CPU usage go up, so it does not seem to be an infinite loop that is causing the problem.

I'm somewhat lost as to how I can continue debugging this applet. Any suggestions? Any ideas that could point me in a constructive direction are very welcome!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-08-2008, 07:45 AM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
I hope you didn't initialize the GUI on paint(method)... sometimes, others don't care about it. It should be used for Draw or to print some text.

can you show as the pseudocode of your program?
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-08-2008, 12:13 PM
Member
 
Join Date: May 2008
Posts: 7
olbion is on a distinguished road
Hi,

Thank you for your answer. Do you mean whether the applet main class makes use of the "paint(Graphics g)" method? If so, the answer is no.

I've managed to isolate the problem further. What happens is this:

An event is sent from a server to the java applet/client. Among these, a button is disabled, and a html string is read into a JEditorPane. I've discovered that commenting ONE of these actions out, the applet runs fine. That is, it can either disable the button OR read the string into the JEditorPane, but not both - then it freezes. The offending code lines are:

EditorKit kit = getEditorKit();
StringReader reader = new StringReader(html);
Document doc = getDocument();
kit.read(reader, doc, doc.getLength()); //A

-------------------

Canvas.setEnabled(false) //B

I have to comment out either (A) or (B). If both (A) and (B) are active, then the applet freezes, when executing (B). If one or both are commented out, the applet runs fine.

Any ideas? All help very much appreciated!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JAVA software solutions:For AP Comp. Science (Lewis,Loftus,Cocking) padutch New To Java 4 11-28-2007 01:59 AM
help debugging a dice game Windoze Advanced Java 0 11-17-2007 12:28 AM
Debugging In NetBeans IDE JavaForums NetBeans 0 07-31-2007 01:13 AM
Struts - Solutions for creating Wizards Larry Web Frameworks 1 07-11-2007 07:59 PM
SMS Solutions on GSM and SMPP smany Introductions 2 07-10-2007 04:22 PM


All times are GMT +3. The time now is 05:24 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org