• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JEditor Pane - HTML Page

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the following code to display a HTMLpage.
But the pane is not visible even though its set to true...
No exception is beinmg thrown.
*****************************************************
helpMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
try
{
helpPane = new JEditorPane();
helpPane.setEditable(false);
helpPane.setContentType("text/html");
File htmlFile=new File("test.html");
URL helpUrl=htmlFile.toURL();
helpPane.setPage(helpUrl);
helpPane.setSize(400,400);
helpPane.setVisible(true);
}
catch(Exception e)
{
e.printStackTrace();
}
}
});
*******************************************************************
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JEditorPane is not a top-level window, it's a component that must be added to a window to be shown. So, for instance, you might add

at the end of the try block below. Also note that the setVisible() call on helpPane doesn't do anything and can be removed.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic