[英]Opening displaying internal help (html) page
我似乎不記得如何打開和顯示內部 html 幫助文件(只讀)。
我正在使用 Netbeans IDE 8.2 並創建了一個帶有菜單欄的桌面窗格。 當用戶從幫助菜單中選擇幫助時,我希望它顯示一個內部框架,顯示我已添加到資源中的 html 幫助文件。
在 menuHelpHelpActionPerformed 中,我調用了 myHelpFile()。 我的幫助文件:
initialUrl = "C:\\Users\\Mike\\Documents\\NetBeansProjects\\IwtTest2\\src\\iwt\\Resoruces\\iwtHelp.html";
try{
html = new JEditorPane(initialUrl);
html.setEditable(false);
html.addHyperlinkListener((HyperlinkListener) this);
scrollpane = new JScrollPane(html);
getContentPane().add(html);
}catch(IOException ioe){
JOptionPane.showMessageDialog(null,"<html>OOPS! no file: <br></br></html>" + ioe);
}
當我 select 幫助它只顯示消息對話框時發生的所有事情。 我怎樣才能解決這個問題?
已解決:通過 Cay S. Horstmann 和 Gary Cornell 的 Core Java 2 高級功能的示例(示例 6-15),我能夠實現我想要的:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.