Class MessageTree

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeSelectionListener

public class MessageTree extends JPanel implements TreeSelectionListener
Displays a parsed Message in a window. The window will be divided into two panels. The left panel displays the Message tree. Clicking on a node in the tree shows information on that node in the right panel. Some of this code have been copied from the Java tutorial's JTree section.
See Also:
  • Field Details

  • Constructor Details

    • MessageTree

      public MessageTree(Message message)
      Creates a new MessageTree instance displaying the specified Message.
      Parameters:
      message - the message to display.
  • Method Details

    • createNode

      private DefaultMutableTreeNode createNode(Header header)
      Create a node given a Multipart body. Add the Preamble, all Body parts and the Epilogue to the node.
      Returns:
      the root node of the tree.
    • createNode

      private DefaultMutableTreeNode createNode(Multipart multipart)
      Create a node given a Multipart body. Add the Preamble, all Body parts and the Epilogue to the node.
      Parameters:
      multipart - the Multipart.
      Returns:
      the root node of the tree.
    • createNode

      private DefaultMutableTreeNode createNode(Entity entity)
      Creates the tree nodes given a MIME entity (either a Message or a BodyPart).
      Parameters:
      entity - the entity.
      Returns:
      the root node of the tree displaying the specified entity and its children.
    • valueChanged

      public void valueChanged(TreeSelectionEvent e)
      Called whenever the selection changes in the JTree instance showing the Message nodes.
      Specified by:
      valueChanged in interface TreeSelectionListener
      Parameters:
      e - the event.
    • createAndShowGUI

      private static void createAndShowGUI(Message message)
      Creates and displays the gui.
      Parameters:
      message - the Message to display in the tree.
    • main

      public static void main(String[] args)
    • retrieveFileName

      private static String retrieveFileName(String[] args)