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:
ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,RootPaneContainer,WindowConstants
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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUsed to indicate which of the 2 JTextAreas the data (message) is to be displayed.static final intUsed to indicate which of the 2 JTextAreas the data (message) is to be displayed.private JButtonDOCUMENT ME!private InsetsDOCUMENT ME!private intIndicates last state of frame - NORMAL or ICONIFIED.private JMenuBarDOCUMENT ME!private JMenuItemDOCUMENT ME!private static final longUse serialVersionUID for interoperability.private JTabbedPaneDOCUMENT ME!private JToolBarDOCUMENT ME!Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields 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_CURSORFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(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.voidAdds a tab to the MessageFrame tabbed pane with the given Title.voidAppends the text area with the message.voidMethod to append text to an attached JTextArea (not DEBUG or DATA areas).private voidCreates the needed menus.private voidBuilds the toolbar.voidclear(int textAreaID) Clears the text area.getData()Gets text area which data tab prints to.getDebug()Gets text area which debug tab prints to.intGets the display state of the Frame ( either Frame.NORMAL or Frame.ICONIFIED ).intgetLineCount(int textAreaID) Gets the number of lines in the specified text area.private voidInitializes the dialog box to a certain size and adds the components.voidRemoves the Tab associated with the given title (will not allow the removal of DEBUG or DATA tabs.voidSaves the tab's text to a file "Tabname_currenttimems.txt"voidSaves the tab's text to a file "Tabname_currenttimems.txt"voidMethod to append text to an attached JTextArea (not DEBUG or DATA areas).voidsetLastState(int state) Sets the display state of the Frame to be either Frame.NORMAL or Frame.ICONIFIED.voidsetMaximumLines(int maxlines, int textAreaID) Sets the maximum number of lines for the specified text area.voidsetMessage(String message, int textAreaID) Sets the text area to the message, erasing what was there earlier.voidstateChanged(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, updateMethods 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, setUndecoratedMethods 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, toFrontMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
DATA
public static final int DATAUsed to indicate which of the 2 JTextAreas the data (message) is to be displayed.- See Also:
-
DEBUG
public static final int DEBUGUsed to indicate which of the 2 JTextAreas the data (message) is to be displayed.- See Also:
-
delTabButton
DOCUMENT ME! -
frameInsets
DOCUMENT ME! -
lastState
private int lastStateIndicates last state of frame - NORMAL or ICONIFIED. -
removeCurrentTab
DOCUMENT ME! -
tabbedPane
DOCUMENT ME! -
tBar
DOCUMENT ME!
-
-
Constructor Details
-
ViewJFrameMessage
Creates new frame.- Parameters:
title- Title of dialog frame
-
-
Method Details
-
actionPerformed
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:
actionPerformedin interfaceActionListener- Parameters:
event- Event that triggers this function
-
addTab
Adds a tab to the MessageFrame tabbed pane with the given Title.- Parameters:
tabTitle- String the title of the new tab to add
-
append
Appends the text area with the message.- Parameters:
appMessage- the messagetextAreaID- DATA, DEBUG, DATA
-
append
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
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:
textAreaID- DATA, DEBUG, DATAappMessage- the message
-
getData
Gets text area which data tab prints to.- Returns:
- 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
-
removeTab
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
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
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
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
Watches for tab index changes.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
event- ChangeEvent the change
-
buildMenu
private void buildMenu()Creates the needed menus. -
buildToolBar
private void buildToolBar()Builds the toolbar. -
init
Initializes the dialog box to a certain size and adds the components.- Parameters:
title- Title of the dialog box
-