Class JPanelRendererBase

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
    Direct Known Subclasses:
    JPanelFlythruMove, JPanelRendererJ3D, JPanelVirtualEndoscopySetup_WM

    public abstract class JPanelRendererBase
    extends javax.swing.JPanel
    implements java.awt.event.KeyListener, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.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:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.JButton applyButton
      Apply button is used to apply the setting of the dialog.
      protected javax.swing.JButton cancelButton
      Cancel button is used on most dialogs.
      protected boolean cancelFlag
      Flag indicating if the dialog had been cancelled or not.
      protected javax.swing.JButton closeButton
      Close button is used to close the dialog.
      protected javax.swing.JButton helpButton
      Help button is used on most dialogs.
      protected boolean isActiveImage
      DOCUMENT ME!
      protected javax.swing.JPanel mainPanel
      The main control.
      protected static int NEW
      NEW indicates a new image is created after the algorithm is run.
      protected javax.swing.JButton OKButton
      OK button is used on most dialogs.
      protected static int REPLACE
      REPLACE indicates the current image is replaced after algorithm is run.
      protected boolean runInSeparateThread
      Flag indicating if the algorithm should run in a separate thread.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      protected java.awt.Font serif12
      Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      protected java.awt.Font serif12B
      Fonts, same as MipavUtil.font12 and MipavUtil.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_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      JPanelRendererBase()
      Constructor that sets the parent frame of the dialog and whether or not the dialog is modal.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void actionPerformed​(java.awt.event.ActionEvent event)
      Action performed method.
      protected javax.swing.JButton buildApplyButton()
      Builds the cancel button.
      protected javax.swing.JButton buildCancelButton()
      Builds the cancel button.
      protected javax.swing.JButton buildCloseButton()
      Builds the close button.
      protected javax.swing.JButton buildHelpButton()
      Builds the help button.
      protected javax.swing.JButton buildOKButton()
      Builds the OK button.
      static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      void disposeLocal()
      Clear memory.
      protected void finalize()
      Calls finalize().
      void focusGained​(java.awt.event.FocusEvent event)
      Unchanged.
      void focusLost​(java.awt.event.FocusEvent event)
      Unchanged.
      abstract javax.swing.JPanel getMainPanel()
      Each panel class extends their own get the main control panel method.
      boolean isCancelled()
      Accessor that returns whether or not the dialog has been cancelled.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Unchanged.
      void keyPressed​(java.awt.event.KeyEvent e)
      Unchanged.
      void keyReleased​(java.awt.event.KeyEvent e)
      Unchanged.
      void keyTyped​(java.awt.event.KeyEvent e)
      OK or Cancel should be in focus and if the return key pressed the appropriate action takes place.
      java.lang.String makeString​(float number, int decPts)
      Makes a string of a floating point number with a specific number of decimal points.
      void resizePanel​(int panelWidth, int frameHeight)
      Resize the control panel when mouse drag expanding or minimizing the frame.
      void setLeftHandSystem​(boolean leftHandSys)
      Sets the left-hand coordinate flag.
      void setVisible​(boolean status)
      Makes the dialog visible in center of screen.
      void setVisibleStandard​(boolean status)
      Makes the dialog visible by calling super method.
      void setWCSystem​(boolean wcSys)
      Sets the world coordinate flag.
      protected boolean testParameter​(java.lang.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, updateUI
      • Methods 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, update
      • Methods 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, validateTree
      • Methods 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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • REPLACE

        protected static final int REPLACE
        REPLACE indicates the current image is replaced after algorithm is run.
        See Also:
        Constant Field Values
      • NEW

        protected static final int NEW
        NEW indicates a new image is created after the algorithm is run.
        See Also:
        Constant Field Values
      • applyButton

        protected javax.swing.JButton applyButton
        Apply button is used to apply the setting of the dialog.
      • cancelButton

        protected javax.swing.JButton 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 cancelFlag
        Flag indicating if the dialog had been cancelled or not.
      • closeButton

        protected javax.swing.JButton closeButton
        Close button is used to close the dialog.
      • helpButton

        protected javax.swing.JButton 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 isActiveImage
        DOCUMENT ME!
      • mainPanel

        protected javax.swing.JPanel mainPanel
        The main control.
      • OKButton

        protected javax.swing.JButton 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 runInSeparateThread
        Flag indicating if the algorithm should run in a separate thread. Default is true.
      • serif12

        protected java.awt.Font serif12
        Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      • serif12B

        protected java.awt.Font serif12B
        Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
    • Constructor Detail

      • 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 Detail

      • actionPerformed

        public abstract void actionPerformed​(java.awt.event.ActionEvent event)
        Action performed method.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        event - ActionEvent
      • getMainPanel

        public abstract javax.swing.JPanel 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

        public void focusGained​(java.awt.event.FocusEvent event)
        Unchanged.
        Specified by:
        focusGained in interface java.awt.event.FocusListener
        Parameters:
        event - DOCUMENT ME!
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent event)
        Unchanged.
        Specified by:
        focusLost in interface java.awt.event.FocusListener
        Parameters:
        event - DOCUMENT ME!
      • isCancelled

        public boolean isCancelled()
        Accessor that returns whether or not the dialog has been cancelled.
        Returns:
        true indicates cancelled, false indicates not cancelled.
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Unchanged.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Parameters:
        event - DOCUMENT ME!
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Unchanged.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
        Parameters:
        e - DOCUMENT ME!
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Unchanged.
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
        Parameters:
        e - DOCUMENT ME!
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        OK or Cancel should be in focus and if the return key pressed the appropriate action takes place.
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
        Parameters:
        e - The event that triggers the function.
      • makeString

        public java.lang.String makeString​(float number,
                                           int decPts)
        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 - width
        frameHeight - 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:
        setVisible in class javax.swing.JComponent
        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

        protected javax.swing.JButton buildApplyButton()
        Builds the cancel button. Sets it internally as well
        Returns:
        applyButton the apply button
      • buildCancelButton

        protected javax.swing.JButton buildCancelButton()
        Builds the cancel button. Sets it internally as well return the just-built button.
        Returns:
        DOCUMENT ME!
      • buildCloseButton

        protected javax.swing.JButton buildCloseButton()
        Builds the close button. Sets it internally as well return the just-built button.
        Returns:
        DOCUMENT ME!
      • buildHelpButton

        protected javax.swing.JButton buildHelpButton()
        Builds the help button. Sets it internally as well
        Returns:
        helpButton the help button
      • buildOKButton

        protected javax.swing.JButton buildOKButton()
        Builds the OK button. Sets it internally as well return the just-built button.
        Returns:
        DOCUMENT ME!
      • buildTitledBorder

        public static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
        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

        protected void finalize()
                         throws java.lang.Throwable
        Calls finalize().
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - DOCUMENT ME!
      • testParameter

        protected boolean testParameter​(java.lang.String str,
                                        double minValue,
                                        double maxValue)
        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:
        true if parameters passed range test, false if failed.