Class ViewJFrameMessage

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants

public class ViewJFrameMessage extends JFrame implements ActionListener, ChangeListener
This class produces a message frame where user data, logging and debug information can be displayed. The frame can be resize and a scroll pane is used where scroll bars are displayed as needed. This frame also gives the user the ability to edit and save the data as needed to a text file. Each image (ModelImage) keeps a data and a logging (JTextAreas) objects to record information specific to itself. Only one global data object and and one debug text object exists for the whole MIPAV application.
Version:
1.0 Oct 24, 1998
Author:
Matthew J. McAuliffe, Ph.D.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • DATA

      public static final int DATA
      Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.
      See Also:
    • DEBUG

      public static final int DEBUG
      Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.
      See Also:
    • delTabButton

      private JButton delTabButton
      DOCUMENT ME!
    • frameInsets

      private Insets frameInsets
      DOCUMENT ME!
    • lastState

      private int lastState
      Indicates last state of frame - NORMAL or ICONIFIED.
    • removeCurrentTab

      private JMenuItem removeCurrentTab
      DOCUMENT ME!
    • tabbedPane

      private JTabbedPane tabbedPane
      DOCUMENT ME!
    • tBar

      private JToolBar tBar
      DOCUMENT ME!
  • Constructor Details

    • ViewJFrameMessage

      public ViewJFrameMessage(String title)
      Creates new frame.
      Parameters:
      title - Title of dialog frame
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      If "Save", saves text to file; if "Clear", clears appropriate text area; if "Copy", copies text to clipboard; if "Cut", removes the text and copies it to the clipboard; and if "Select", selects all text in text area.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - Event that triggers this function
    • addTab

      public void addTab(String tabTitle)
      Adds a tab to the MessageFrame tabbed pane with the given Title.
      Parameters:
      tabTitle - String the title of the new tab to add
    • append

      public void append(String appMessage, int textAreaID)
      Appends the text area with the message.
      Parameters:
      appMessage - the message
      textAreaID - DATA, DEBUG, DATA
    • append

      public void append(String tabTitle, String appMessage)
      Method to append text to an attached JTextArea (not DEBUG or DATA areas).
      Parameters:
      tabTitle - String The title of the attached tab
      appMessage - String the message to be appended
    • setFont

      public void setFont(String tabTitle, Font font)
      Method to append text to an attached JTextArea (not DEBUG or DATA areas).
      Parameters:
      tabTitle - String The title of the attached tab
      font - font of the appended message
    • clear

      public void clear(int textAreaID)
      Clears the text area.
      Parameters:
      textAreaID - DOCUMENT ME!
    • getLineCount

      public int getLineCount(int textAreaID)
      Gets the number of lines in the specified text area. Returns -1 if the specified textAreaID is not found/is not valid
      Parameters:
      textAreaID - DATA, DEBUG, DATA
      appMessage - the message
    • getData

      public JTextArea getData()
      Gets text area which data tab prints to.
      Returns:
      JTextArea
    • getDebug

      public JTextArea getDebug()
      Gets text area which debug tab prints to.
      Returns:
      JTextArea
    • getLastState

      public int getLastState()
      Gets the display state of the Frame ( either Frame.NORMAL or Frame.ICONIFIED ).
      Returns:
      state Should be either Frame.NORMAL or Frame.ICONIFIED
    • getTabbedPane

      public JTabbedPane getTabbedPane()
    • removeTab

      public void removeTab(String tabTitle)
      Removes the Tab associated with the given title (will not allow the removal of DEBUG or DATA tabs.
      Parameters:
      tabTitle - String the title of the tab to be removed
    • save

      public void save(String tabName)
      Saves the tab's text to a file "Tabname_currenttimems.txt"
      Parameters:
      tabName - String tabName (can be data/debug/ or any custom tab added)
    • save

      public void save(String directory, String tabName)
      Saves the tab's text to a file "Tabname_currenttimems.txt"
      Parameters:
      tabName - String tabName (can be data/debug/ or any custom tab added)
    • setLastState

      public void setLastState(int state)
      Sets the display state of the Frame to be either Frame.NORMAL or Frame.ICONIFIED.
      Parameters:
      state - Should be either Frame.NORMAL or Frame.ICONIFIED
    • setMessage

      public void setMessage(String message, int textAreaID)
      Sets the text area to the message, erasing what was there earlier.
      Parameters:
      message - message
      textAreaID - DATA, DEBUG, DATA
    • setMaximumLines

      public void setMaximumLines(int maxlines, int textAreaID)
      Sets the maximum number of lines for the specified text area. Excess lines will continually be removed from start/beginning of the text area.
      Parameters:
      maxlines - the maximum number of allowed lines
      textAreaID - DATA, DEBUG, DATA
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Watches for tab index changes.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - ChangeEvent the change
    • buildMenu

      private void buildMenu()
      Creates the needed menus.
    • buildToolBar

      private void buildToolBar()
      Builds the toolbar.
    • init

      private void init(String title)
      Initializes the dialog box to a certain size and adds the components.
      Parameters:
      title - Title of the dialog box