Class 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:
  • Field Details

    • serialVersionUID

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

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

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

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

      protected 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 JButton closeButton
      Close button is used to close the dialog.
    • helpButton

      protected 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 JPanel mainPanel
      The main control.
    • OKButton

      protected 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 Font serif12
      Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
    • serif12B

      protected Font serif12B
      Fonts, same as MipavUtil.font12 and MipavUtil.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

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

      public abstract 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(FocusEvent event)
      Unchanged.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      event - DOCUMENT ME!
    • focusLost

      public void focusLost(FocusEvent event)
      Unchanged.
      Specified by:
      focusLost in interface 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(ItemEvent event)
      Unchanged.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      event - DOCUMENT ME!
    • keyPressed

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

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

      public void keyTyped(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 KeyListener
      Parameters:
      e - The event that triggers the function.
    • makeString

      public 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 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 JButton buildApplyButton()
      Builds the cancel button. Sets it internally as well
      Returns:
      applyButton the apply button
    • buildCancelButton

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

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

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

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

      public static TitledBorder buildTitledBorder(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 Throwable
      Calls finalize().
      Overrides:
      finalize in class Object
      Throws:
      Throwable - DOCUMENT ME!
    • testParameter

      protected boolean testParameter(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.