Exemplo n.º 1
0
  // Define a setMessage() method.
  private void setMessage(JTextAreaPanel out, JTextAreaPanel in) {
    // Try to get incoming message.
    try {
      // Send message text.
      in.setMessage(out.getText());

      // Consume sent message text.
      out.replaceRange(null, 0, out.getText().length());

    } // End of try to get message.

    // Catch BufferEmptyException.
    catch (BufferEmptyException e) {
      // Capture the stack trace into a String.
      setExceptionString(e.fillInStackTrace());

      // Pass message to the JOptionPane manager.
      setExceptionPane(
          "There is nothing in the buffer to send.\n\n" + "Do you want to see the stack trace?");
    } // End of catch on BufferEmptyException.
  } // End of setMessage() method.