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();
|
RTFEditorKit rtf = new RTFEditorKit();
|
||||||
InputStream in1 = SavantShell.class.getResourceAsStream("savanthelp.rtf");
|
InputStream in1 = SavantShell.class.getResourceAsStream("savanthelp.rtf");
|
||||||
InputStream in2 = SavantShell.class.getResourceAsStream("aboutsavant.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 doc1 = new DefaultStyledDocument();
|
||||||
DefaultStyledDocument doc2 = new DefaultStyledDocument();
|
DefaultStyledDocument doc2 = new DefaultStyledDocument();
|
||||||
try {
|
try {
|
||||||
|
@ -65,8 +73,8 @@ public class SavantShell extends JFrame
|
||||||
} catch (BadLocationException ioe) {
|
} catch (BadLocationException ioe) {
|
||||||
return;
|
return;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
System.out.println("can't find savanthelp or aboutsavant");
|
System.out.println("Can't find one of savanthelp.rtf or aboutsavant.rtf.");
|
||||||
return;
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
JTextPane pane1 = new JTextPane(doc1);
|
JTextPane pane1 = new JTextPane(doc1);
|
||||||
|
|
Loading…
Reference in a new issue