ExceptionMethods.java




public class ExceptionMethods extends JApplet {
  JTextArea  Xout  = new JTextArea(10, 50);
  public void init() {
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(new JLabel("ExceptionMethods!"));
    cp.add(new JScrollPane(Xout));
    try {
      throw new Exception("Here's my Exception");
    } catch(Exception e) {
      Xout.append("Caught Exception\n");
      Xout.append(
        "e.getMessage(): " + e.getMessage() + "\n");
      Xout.append(
        "e.getLocalizedMessage(): " +
         e.getLocalizedMessage() + "\n");
      Xout.append("e.toString(): " + e + "\n");
      Xout.append("e.printStackTrace():\n");
      e.printStackTrace(System.err);
     }
  }

  public static void main(String[] args) {
        Console.run(new ExceptionMethods(), 600, 300);
  }
 
} ///:~