More robust--handles the case when Savant's RTF files cannot be found.
This commit is contained in:
parent
baf7a7c17d
commit
3006b120dc
1 changed files with 10 additions and 2 deletions
|
@ -57,6 +57,14 @@ public class SavantShell extends JFrame
|
|||
RTFEditorKit rtf = new RTFEditorKit();
|
||||
InputStream in1 = SavantShell.class.getResourceAsStream("savanthelp.rtf");
|
||||
InputStream in2 = SavantShell.class.getResourceAsStream("aboutsavant.rtf");
|
||||
if (in1 == null) {
|
||||
System.out.println("Can't find savanthelp.rtf.");
|
||||
System.exit(1);
|
||||
}
|
||||
if (in2 == null) {
|
||||
System.out.println("Can't find aboutsavant.rtf.");
|
||||
System.exit(1);
|
||||
}
|
||||
DefaultStyledDocument doc1 = new DefaultStyledDocument();
|
||||
DefaultStyledDocument doc2 = new DefaultStyledDocument();
|
||||
try {
|
||||
|
@ -65,8 +73,8 @@ public class SavantShell extends JFrame
|
|||
} catch (BadLocationException ioe) {
|
||||
return;
|
||||
} catch (IOException ioe) {
|
||||
System.out.println("can't find savanthelp or aboutsavant");
|
||||
return;
|
||||
System.out.println("Can't find one of savanthelp.rtf or aboutsavant.rtf.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
JTextPane pane1 = new JTextPane(doc1);
|
||||
|
|
Loading…
Reference in a new issue