Package hermes.swing

Examples of hermes.swing.MyTextArea


    super();
  }

  @Override
  public JComponent render(JScrollPane parent, Message m) {
    final JTextArea textArea = new MyTextArea();

    textArea.setEditable(false);
    textArea.setFont(Font.decode("Monospaced-PLAIN-12"));

    byte[] bytes = null;

    try {
      bytes = MessageUtils.asBytes(m);
      textArea.setText(DumpUtils.dumpBinary(bytes, DumpUtils.DUMP_AS_HEX_AND_ALPHA));
    } catch (Throwable e) {
      textArea.setText(e.getMessage());

      log.error("exception converting message to byte[]: ", e);
    }

    textArea.setCaretPosition(0);

    return textArea;
  }
View Full Code Here


   * @throws ClassNotFoundException
   */
  protected JComponent handleBytesMessage(JScrollPane parent, BytesMessage bytesMessage) throws JMSException, IOException, ClassNotFoundException {
    final MyConfig currentConfig = (MyConfig) getConfig();

    JTextArea textPane = new MyTextArea();

    textPane.setEditable(false);
    textPane.setWrapStyleWord(true);
    textPane.setLineWrap(true);
    bytesMessage.reset();

    if (currentConfig.isBytesIsObject()) {
      final byte[] bytes = MessageUtils.asBytes(bytesMessage);
      final ByteArrayInputStream bistream = new ByteArrayInputStream(bytes);
      final ObjectInputStream oistream = new ObjectInputStream(bistream);
      final Object o = oistream.readObject();

      textPane.setText(o.toString());
    } else if (currentConfig.isBytesIsString()) {
      try {
        String text = new String(MessageUtils.asBytes(bytesMessage), currentConfig.getBytesEncoding());
        textPane.setText(text);
        return textPane;
      } catch (JMSException e) {
        textPane.setText(e.getMessage());
      }
    } else {
      HexMessageRenderer renderer = new HexMessageRenderer();
      textPane = (JTextArea) renderer.render(parent, bytesMessage); // Hack.
    }

    textPane.setCaretPosition(0);

    return textPane;
  }
View Full Code Here

    super();
  }

  @Override
  public JComponent render(JScrollPane parent, Message m) {
    final JTextArea textArea = new MyTextArea();

    textArea.setEditable(false);
    textArea.setFont(Font.decode("Monospaced-PLAIN-12"));
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    textArea.setText(m.toString());
    textArea.setCaretPosition(0);

    return textArea;
  }
View Full Code Here

TOP

Related Classes of hermes.swing.MyTextArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.