Package gov.nih.mipav.view
Class ViewJFrameMessage
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- gov.nih.mipav.view.ViewJFrameMessage
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.ChangeListener
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class ViewJFrameMessage extends javax.swing.JFrame implements java.awt.event.ActionListener, javax.swing.event.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ViewJFrameMessage.ScrollTextArea
DOCUMENT ME!-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description static int
DATA
Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.static int
DEBUG
Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.private javax.swing.JButton
delTabButton
DOCUMENT ME!private java.awt.Insets
frameInsets
DOCUMENT ME!private int
lastState
Indicates last state of frame - NORMAL or ICONIFIED.private javax.swing.JMenuBar
menu
DOCUMENT ME!private javax.swing.JMenuItem
removeCurrentTab
DOCUMENT ME!private static long
serialVersionUID
Use serialVersionUID for interoperability.private javax.swing.JTabbedPane
tabbedPane
DOCUMENT ME!private javax.swing.JToolBar
tBar
DOCUMENT ME!-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description ViewJFrameMessage(java.lang.String title)
Creates new frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.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.void
addTab(java.lang.String tabTitle)
Adds a tab to the MessageFrame tabbed pane with the given Title.void
append(java.lang.String appMessage, int textAreaID)
Appends the text area with the message.void
append(java.lang.String tabTitle, java.lang.String appMessage)
Method to append text to an attached JTextArea (not DEBUG or DATA areas).private void
buildMenu()
Creates the needed menus.private void
buildToolBar()
Builds the toolbar.void
clear(int textAreaID)
Clears the text area.javax.swing.JTextArea
getData()
Gets text area which data tab prints to.javax.swing.JTextArea
getDebug()
Gets text area which debug tab prints to.int
getLastState()
Gets the display state of the Frame ( either Frame.NORMAL or Frame.ICONIFIED ).int
getLineCount(int textAreaID)
Gets the number of lines in the specified text area.javax.swing.JTabbedPane
getTabbedPane()
private void
init(java.lang.String title)
Initializes the dialog box to a certain size and adds the components.void
removeTab(java.lang.String tabTitle)
Removes the Tab associated with the given title (will not allow the removal of DEBUG or DATA tabs.void
save(java.lang.String tabName)
Saves the tab's text to a file "Tabname_currenttimems.txt"void
save(java.lang.String directory, java.lang.String tabName)
Saves the tab's text to a file "Tabname_currenttimems.txt"void
setFont(java.lang.String tabTitle, java.awt.Font font)
Method to append text to an attached JTextArea (not DEBUG or DATA areas).void
setLastState(int state)
Sets the display state of the Frame to be either Frame.NORMAL or Frame.ICONIFIED.void
setMaximumLines(int maxlines, int textAreaID)
Sets the maximum number of lines for the specified text area.void
setMessage(java.lang.String message, int textAreaID)
Sets the text area to the message, erasing what was there earlier.void
stateChanged(javax.swing.event.ChangeEvent event)
Watches for tab index changes.-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
DATA
public static final int DATA
Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.- See Also:
setMessage(String, int)
, Constant Field Values
-
DEBUG
public static final int DEBUG
Used to indicate which of the 2 JTextAreas the data (message) is to be displayed.- See Also:
setMessage(String, int)
, Constant Field Values
-
delTabButton
private javax.swing.JButton delTabButton
DOCUMENT ME!
-
frameInsets
private java.awt.Insets frameInsets
DOCUMENT ME!
-
lastState
private int lastState
Indicates last state of frame - NORMAL or ICONIFIED.
-
menu
private javax.swing.JMenuBar menu
DOCUMENT ME!
-
removeCurrentTab
private javax.swing.JMenuItem removeCurrentTab
DOCUMENT ME!
-
tabbedPane
private javax.swing.JTabbedPane tabbedPane
DOCUMENT ME!
-
tBar
private javax.swing.JToolBar tBar
DOCUMENT ME!
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.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 interfacejava.awt.event.ActionListener
- Parameters:
event
- Event that triggers this function
-
addTab
public void addTab(java.lang.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(java.lang.String appMessage, int textAreaID)
Appends the text area with the message.- Parameters:
appMessage
- the messagetextAreaID
- DATA, DEBUG, DATA
-
append
public void append(java.lang.String tabTitle, java.lang.String appMessage)
Method to append text to an attached JTextArea (not DEBUG or DATA areas).- Parameters:
tabTitle
- String The title of the attached tabappMessage
- String the message to be appended
-
setFont
public void setFont(java.lang.String tabTitle, java.awt.Font font)
Method to append text to an attached JTextArea (not DEBUG or DATA areas).- Parameters:
tabTitle
- String The title of the attached tabfont
- 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:
appMessage
- the messagetextAreaID
- DATA, DEBUG, DATA
-
getData
public javax.swing.JTextArea getData()
Gets text area which data tab prints to.- Returns:
- JTextArea
-
getDebug
public javax.swing.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 javax.swing.JTabbedPane getTabbedPane()
-
removeTab
public void removeTab(java.lang.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(java.lang.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(java.lang.String directory, java.lang.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(java.lang.String message, int textAreaID)
Sets the text area to the message, erasing what was there earlier.- Parameters:
message
- messagetextAreaID
- 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 linestextAreaID
- DATA, DEBUG, DATA
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent event)
Watches for tab index changes.- Specified by:
stateChanged
in interfacejavax.swing.event.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(java.lang.String title)
Initializes the dialog box to a certain size and adds the components.- Parameters:
title
- Title of the dialog box
-
-