Results 1 to 11 of 11
  1. #1
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default [SOLVED] JEditorPane bug?

    hi, im trying to display a webpage in a jeditor pane using its setPage method,
    but when i try to skip back an forth to the content(source, and normal view) its seems to produce some runtime error.

    i tried clearing the pane between the two contents but that does not work...
    info on the net tells me this is a editorpane bug.

    Can someone point me to the solution?
    thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    Tis is the method that is incorrect, i guess...
    thanks
    Java Code:
    private void getThePage(String location)
        {
        	location = "http://" + location;
            
        	if ((box.getSelectedItem()) == "normal")
        	{
    
            	try
            	{
            		contentsArea.setPage(location);
            		//field.setText(location);
            	}
            	catch(IOException ex)
            	{
            		JOptionPane.showMessageDialog(this, ex.toString(), "bad url", JOptionPane.ERROR_MESSAGE);
            		
            	}
        	}
            if ((box.getSelectedItem()) == "source")
            	{
            		try
            		{
                        URL myRequest = new URL(location);
                        BufferedReader inMessage = new BufferedReader(new InputStreamReader(myRequest.openStream()));
                        String httpReplay, content = "";
                        while ((httpReplay = inMessage.readLine()) != null)
                        {
                        httpReplay = inMessage.readLine();
                        contentsArea.setText(content + httpReplay + "\n");
                        content = contentsArea.getText();
                        }
                        
                        inMessage.close();                   
                    }
                    catch(MalformedURLException ex)
                    {
                    	JOptionPane.showMessageDialog(this, ex.toString(), "bad url", JOptionPane.ERROR_MESSAGE);
                    }
                    catch(IOException ex)
                    {
                    	JOptionPane.showMessageDialog(this, ex.toString(),"IO_error", JOptionPane.ERROR_MESSAGE);
                    }
                      
            	}
    Last edited by shwein; 03-28-2009 at 05:51 PM.

  4. #4
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    sry wrong code tags :)

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Lol, can you send the full error message you get there. It's difficult to say more about your code, since we don't have more details.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  7. #7
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    sry, my bad
    Last edited by shwein; 03-29-2009 at 05:49 PM.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  9. #9
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    nope, but i worked around it ;)

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  11. #11
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    i stopt trying to 'refresh' one Pane, instead i use 2 Panes now.
    i consider i 'solved' now...:)

Similar Threads

  1. Javascript in JEditorpane
    By Narayan15 in forum AWT / Swing
    Replies: 1
    Last Post: 03-27-2009, 05:49 PM
  2. JEditorPane Example
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:47 PM
  3. insertHTML in a JEditorPane
    By olbion in forum New To Java
    Replies: 1
    Last Post: 05-05-2008, 12:30 PM
  4. jeditorpane help parsing html
    By asifsolkar in forum Advanced Java
    Replies: 4
    Last Post: 12-14-2007, 05:23 AM
  5. JEditorPane
    By drmmr11 in forum Java Applets
    Replies: 0
    Last Post: 08-02-2007, 06:08 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
  •