commit 63154ab325ccce9901eedba5ba7266f119f7842b from: marcus date: Mon Oct 18 06:48:56 2004 UTC From Alison Winters alisonmirrabooka.com de.mud.jta.Help - enhancement: if help URL is not found using getResource(), try to parse it as a real URL (e.g. "http://www.example.com/help") - enhancement: if no help URL can be found or loaded, default to a small JOptionPane instead of a really big JEditorPane window de.mud.jta.Main - bug fix: remove useless "print" option from File menu if there is no Terminal object in the plugin list. - bug fix: setVisible(true) instead of show() (show() is deprecated in 1.5) commit - 62e5522dea2b8d8c68febfd799482dfac7b371e5 commit + 63154ab325ccce9901eedba5ba7266f119f7842b blob - a2b3254bd52942131470fe541d6ffb1c12b30c26 blob + 7741a06af57299263dd008464ade249ab5dcb956 --- de/mud/jta/Help.java +++ de/mud/jta/Help.java @@ -28,6 +28,7 @@ package de.mud.jta; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import java.awt.BorderLayout; @@ -38,6 +39,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.IOException; +import java.net.URL; /** * Help display for JTA. @@ -58,8 +60,16 @@ public class Help { try { helpText.setPage(Help.class.getResource(url)); } catch (IOException e) { - System.err.println("unable to load help"); - helpText.setText("The Java Telnet Applet/Application\r\n(c) 1996-2004 Matthias L. Jugel, Marcus Meißner\r\n\r\n"); + try { + helpText.setPage(new URL(url)); + } + catch (Exception ee) + { + System.err.println("unable to load help"); + JOptionPane.showMessageDialog(parent, "The Java Telnet Applet/Application\r\n(c) 1996-2004 Matthias L. Jugel, Marcus Meißner\r\n\r\n", + "jta", JOptionPane.INFORMATION_MESSAGE); + return; + } } helpText.setEditable(false); blob - 15e259cb85360d74584d2a6264055e7a6518aeb0 blob + 3603420af5214594351c34b4c15d531615f36def --- de/mud/jta/Main.java +++ de/mud/jta/Main.java @@ -1,7 +1,7 @@ /* * This file is part of "The Java Telnet Application". * - * (c) Matthias L. Jugel, Marcus Meißner 1996-2002. All Rights Reserved. + * (c) Matthias L. Jugel, Marcus Meissner 1996-2002. All Rights Reserved. * * Please visit http://javatelnet.org/ for updates and contact. * @@ -69,7 +69,7 @@ import java.util.Properties; * Maintainer: Matthias L. Jugel * * @version $Id$ - * @author Matthias L. Jugel, Marcus Meißner + * @author Matthias L. Jugel, Marcus Meissner */ public class Main { @@ -221,22 +221,22 @@ public class Main { } }); file.addSeparator(); - file.add(tmp = new JMenuItem("Print")); - tmp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK)); - tmp.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { - if (setup.getComponents().get("Terminal") != null) { - PrintJob printJob = - frame.getToolkit().getPrintJob(frame, "JTA Terminal", null); - // return if the user clicked cancel - if (printJob == null) return; - ((JComponent) setup.getComponents().get("Terminal")) - .print(printJob.getGraphics()); - printJob.end(); + if (setup.getComponents().get("Terminal") != null) { + file.add(tmp = new JMenuItem("Print")); + tmp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_MASK)); + tmp.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + PrintJob printJob = + frame.getToolkit().getPrintJob(frame, "JTA Terminal", null); + // return if the user clicked cancel + if (printJob == null) return; + ((JComponent) setup.getComponents().get("Terminal")) + .print(printJob.getGraphics()); + printJob.end(); } - } - }); - file.addSeparator(); + }); + file.addSeparator(); + } file.add(tmp = new JMenuItem("Exit")); tmp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @@ -294,7 +294,7 @@ public class Main { else frame.pack(); - frame.show(); + frame.setVisible(true); if(debug > 0) System.err.println("host: '"+host+"', "+host.length());