Package gov.nih.mipav.view.renderer
Class JPanelRendererBase
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nih.mipav.view.renderer.JPanelRendererBase
- All Implemented Interfaces:
ActionListener,FocusListener,ItemListener,KeyListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible
- Direct Known Subclasses:
JPanelFlythruMove,JPanelRendererJ3D,JPanelVirtualEndoscopySetup_WM
public abstract class JPanelRendererBase
extends JPanel
implements KeyListener, ActionListener, FocusListener, ItemListener
This class is the base for all the other dialogs. It has two important functions that are used by almost all the
dialogs. It also implements all the listeners except for the action listener.
- Version:
- 1.0 Aug 1, 1998
- Author:
- Matthew J. McAuliffe, Ph.D. ( Primary ), Ruida Cheng
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested 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 TypeFieldDescriptionprotected JButtonApply button is used to apply the setting of the dialog.protected JButtonCancel button is used on most dialogs.protected booleanFlag indicating if the dialog had been cancelled or not.protected JButtonClose button is used to close the dialog.protected JButtonHelp button is used on most dialogs.protected booleanDOCUMENT ME!protected JPanelThe main control.protected static final intNEW indicates a new image is created after the algorithm is run.protected JButtonOK button is used on most dialogs.protected static final intREPLACE indicates the current image is replaced after algorithm is run.protected booleanFlag indicating if the algorithm should run in a separate thread.private static final longUse serialVersionUID for interoperability.protected FontFonts, same asMipavUtil.font12andMipavUtil.font12B.protected FontFonts, same asMipavUtil.font12andMipavUtil.font12B.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConstructor that sets the parent frame of the dialog and whether or not the dialog is modal. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidactionPerformed(ActionEvent event) Action performed method.protected JButtonBuilds the cancel button.protected JButtonBuilds the cancel button.protected JButtonBuilds the close button.protected JButtonBuilds the help button.protected JButtonBuilds the OK button.static TitledBorderbuildTitledBorder(String title) Builds a titled border with the given title, an etched border, and the proper font and color.voidClear memory.protected voidfinalize()Calls finalize().voidfocusGained(FocusEvent event) Unchanged.voidfocusLost(FocusEvent event) Unchanged.abstract JPanelEach panel class extends their own get the main control panel method.booleanAccessor that returns whether or not the dialog has been cancelled.voiditemStateChanged(ItemEvent event) Unchanged.voidUnchanged.voidUnchanged.voidOK or Cancel should be in focus and if the return key pressed the appropriate action takes place.makeString(float number, int decPts) Makes a string of a floating point number with a specific number of decimal points.voidresizePanel(int panelWidth, int frameHeight) Resize the control panel when mouse drag expanding or minimizing the frame.voidsetLeftHandSystem(boolean leftHandSys) Sets the left-hand coordinate flag.voidsetVisible(boolean status) Makes the dialog visible in center of screen.voidsetVisibleStandard(boolean status) Makes the dialog visible by calling super method.voidsetWCSystem(boolean wcSys) Sets the world coordinate flag.protected booleantestParameter(String str, double minValue, double maxValue) Tests that the entered parameter is in range.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
REPLACE
protected static final int REPLACEREPLACE indicates the current image is replaced after algorithm is run.- See Also:
-
NEW
protected static final int NEWNEW indicates a new image is created after the algorithm is run.- See Also:
-
applyButton
Apply button is used to apply the setting of the dialog. -
cancelButton
Cancel button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus. -
cancelFlag
protected boolean cancelFlagFlag indicating if the dialog had been cancelled or not. -
closeButton
Close button is used to close the dialog. -
helpButton
Help button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus. -
isActiveImage
protected boolean isActiveImageDOCUMENT ME! -
mainPanel
The main control. -
OKButton
OK button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus. -
runInSeparateThread
protected boolean runInSeparateThreadFlag indicating if the algorithm should run in a separate thread. Default istrue. -
serif12
Fonts, same asMipavUtil.font12andMipavUtil.font12B. -
serif12B
Fonts, same asMipavUtil.font12andMipavUtil.font12B.
-
-
Constructor Details
-
JPanelRendererBase
public JPanelRendererBase()Constructor that sets the parent frame of the dialog and whether or not the dialog is modal. Also adds this as a window listener and key listener to all dialogs.- Parameters:
parent- Parent frame.
-
-
Method Details
-
actionPerformed
Action performed method.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
event- ActionEvent
-
getMainPanel
Each panel class extends their own get the main control panel method.- Returns:
- JPanel main control panel
-
disposeLocal
public void disposeLocal()Clear memory. -
focusGained
Unchanged.- Specified by:
focusGainedin interfaceFocusListener- Parameters:
event- DOCUMENT ME!
-
focusLost
Unchanged.- Specified by:
focusLostin interfaceFocusListener- Parameters:
event- DOCUMENT ME!
-
isCancelled
public boolean isCancelled()Accessor that returns whether or not the dialog has been cancelled.- Returns:
trueindicates cancelled,falseindicates not cancelled.
-
itemStateChanged
Unchanged.- Specified by:
itemStateChangedin interfaceItemListener- Parameters:
event- DOCUMENT ME!
-
keyPressed
Unchanged.- Specified by:
keyPressedin interfaceKeyListener- Parameters:
e- DOCUMENT ME!
-
keyReleased
Unchanged.- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- DOCUMENT ME!
-
keyTyped
OK or Cancel should be in focus and if the return key pressed the appropriate action takes place.- Specified by:
keyTypedin interfaceKeyListener- Parameters:
e- The event that triggers the function.
-
makeString
Makes a string of a floating point number with a specific number of decimal points.- Parameters:
number- Number to be converted to a string.decPts- The number of decimal points.- Returns:
- String representation of the number.
-
resizePanel
public void resizePanel(int panelWidth, int frameHeight) Resize the control panel when mouse drag expanding or minimizing the frame.- Parameters:
panelWidth- widthframeHeight- height
-
setLeftHandSystem
public void setLeftHandSystem(boolean leftHandSys) Sets the left-hand coordinate flag. If true, change matrix to the left-hand coordinate system.- Parameters:
leftHandSys- DOCUMENT ME!
-
setVisible
public void setVisible(boolean status) Makes the dialog visible in center of screen.- Overrides:
setVisiblein classJComponent- Parameters:
status- Flag indicating if the dialog should be visible.
-
setVisibleStandard
public void setVisibleStandard(boolean status) Makes the dialog visible by calling super method. No location set.- Parameters:
status- Flag indicating if the dialog should be visible.
-
setWCSystem
public void setWCSystem(boolean wcSys) Sets the world coordinate flag. If true, change matrix to the world coordinate system.- Parameters:
wcSys- DOCUMENT ME!
-
buildApplyButton
Builds the cancel button. Sets it internally as well- Returns:
- applyButton the apply button
-
buildCancelButton
Builds the cancel button. Sets it internally as well return the just-built button.- Returns:
- DOCUMENT ME!
-
buildCloseButton
Builds the close button. Sets it internally as well return the just-built button.- Returns:
- DOCUMENT ME!
-
buildHelpButton
Builds the help button. Sets it internally as well- Returns:
- helpButton the help button
-
buildOKButton
Builds the OK button. Sets it internally as well return the just-built button.- Returns:
- DOCUMENT ME!
-
buildTitledBorder
Builds a titled border with the given title, an etched border, and the proper font and color. Changed to public static member so that it can be used for other JPanels not inherited from this base class.- Parameters:
title- Title of the border- Returns:
- The titled border.
-
finalize
Calls finalize(). -
testParameter
Tests that the entered parameter is in range.- Parameters:
str- The value entered by the user.minValue- The minimum value this variable may be set to.maxValue- The maximum value this variable may be set to.- Returns:
trueif parameters passed range test,falseif failed.
-