• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about Help document

 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, guys:
I am doing the document development. Based on the posts on the forum, i try to use a "Contents and index" menu item under the Help menu. In my understanding, actionEvent->actionListener pattern should be implemented. When the user click the "Contents and index" item, a help document should be pop up. I made some code to do it, but when i clicked the "contents and index" item, no frame show up. Following is my code:
public void actionPerformed(ActionEvent e){
URL helpURL=new URL ("file:///f:/suncertification/xiaoma.html");
JEditorPane editorPane = new JEditorPane();
editorPane.setContentType("text/html");
editorPane.setPage( helpURL );
editorPane.setEditable(true);
JScrollPane helpScrollPane = new JScrollPane(editorPane);
JFrame frame = new JFrame();
Container contentPane = frame.getContentPane();
contentPane.removeAll();
contentPane.add( helpScrollPane );
frame.show();
}
Can u give me some idea how to make this code work? or something wrong in my design?
Thanks!
Xiaoma Wang
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the size or using a JDialog instead of a frame.
 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u, Sai.
i made a big stupid mistake. Now i
got it.
Xiaoma Wang
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic