ファイルの場所を取得し、見つかったファイルの内容に を設定するオブジェクトを作成しようとしていjEditorPane
ます。
コード:
File file = new File("Summary.html");
private void EditoPaneMethod(File file) {
frmRules.pack();
frmRules.setVisible(true);
edpRules.setEditable(false);
try {
edpRules.setPage(file.toURI().toURL());
} catch (IOException ex) {
Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
}
}
誰かが私を正しい方向に向けることができますか?
編集:私の質問が不明かもしれませんが、ここに私のコードがあります:
frmRules.pack();
frmRules.setVisible(true);
edpRules.setEditable(false);
File file = new File("Summary.html");
try {
edpRules.setPage(file.toURI().toURL());
} catch (IOException ex) {
Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
}
ここで、表示したいさまざまなファイルがたくさんあり、各ファイルに同じコードを使用するのは非効率的であるため、メソッドを作成することにしました メソッド EditoPaneMethod() を参照して、メソッドを使用してボタンをコーディングするたびにボタンは、ボタンに関連するファイルを表示します。