Results 1 to 3 of 3
  1. #1
    olbion is offline Member
    Join Date
    May 2008
    Posts
    7
    Rep Power
    0

    Default 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!

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    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?
    freedom exists in the world of ideas

  3. #3
    olbion is offline Member
    Join Date
    May 2008
    Posts
    7
    Rep Power
    0

    Default

    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!

Similar Threads

  1. Replies: 4
    Last Post: 11-28-2007, 12:59 AM
  2. help debugging a dice game
    By Windoze in forum Advanced Java
    Replies: 0
    Last Post: 11-16-2007, 11:28 PM
  3. Debugging In NetBeans IDE
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 07-31-2007, 12:13 AM
  4. Struts - Solutions for creating Wizards
    By Larry in forum Web Frameworks
    Replies: 1
    Last Post: 07-11-2007, 06:59 PM
  5. SMS Solutions on GSM and SMPP
    By smany in forum Introductions
    Replies: 2
    Last Post: 07-10-2007, 03:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •