All Implemented Interfaces:
ActionListener, FocusListener, ItemListener, KeyListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class JPanelView extends JPanelRendererJ3D implements ChangeListener, MouseListener
Dialog to control the view of the 3D surface viewer and renderer. User can switch between standard view and fly mode. Standard view has rotating with standard mouse motions and zooming with the mouse and the alt key down. Fly mode has zooming with the left mouse button, translation with the right mouse button, and pitch and roll with the middle mouse button. There are also buttons on screen for Mac users. The user can warp to different views using the warp controls and record the flight path using the mouse event recorder.
Author:
Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

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

      public static final int STD_MODE
      Stardard viewing mode.
      See Also:
    • FLY_MODE

      public static final int FLY_MODE
      Fly through viewing mode.
      See Also:
    • PTR_MODE

      public static final int PTR_MODE
      Pointer viewing mode.
      See Also:
    • flyBehavior

      private FlyBehaviorRenderer flyBehavior
      Fly behavior reference.
    • flyButton

      private JRadioButton flyButton
      Fly behaviro radio button.
    • flyText

      private String flyText
      User message explain how the mouse moves in fly mode.
    • labels

      private JLabel[] labels
      speed control slider labels.
    • leftDownButton

      private JButton leftDownButton
      DOCUMENT ME!
    • leftLeftButton

      private JButton leftLeftButton
      DOCUMENT ME!
    • leftRightButton

      private JButton leftRightButton
      DOCUMENT ME!
    • leftUpButton

      private JButton leftUpButton
      Arrow button references.
    • middleDownButton

      private JButton middleDownButton
      DOCUMENT ME!
    • middleLeftButton

      private JButton middleLeftButton
      DOCUMENT ME!
    • middleRightButton

      private JButton middleRightButton
      DOCUMENT ME!
    • middleUpButton

      private JButton middleUpButton
      DOCUMENT ME!
    • mode

      private int mode
      Current behavior mode.
    • modeGroup

      private ButtonGroup modeGroup
      Radio button group reference.
    • mouseText

      private JTextArea mouseText
      Text field reference that hold the user message.
    • pointerBehavior

      private PointerBehaviorRenderer pointerBehavior
      Pointer behavior reference, not used now.
    • pressed

      private boolean pressed
      Flag to indicate mouse pressed or not.
    • ptrButton

      private JRadioButton ptrButton
      Point behavior button.
    • rightDownButton

      private JButton rightDownButton
      DOCUMENT ME!
    • rightLeftButton

      private JButton rightLeftButton
      DOCUMENT ME!
    • rightRightButton

      private JButton rightRightButton
      DOCUMENT ME!
    • rightUpButton

      private JButton rightUpButton
      DOCUMENT ME!
    • scroller

      private JScrollPane scroller
      The scroll pane holding the panel content. Useful when the screen is small.
    • scrollPanel

      private JPanelView.DrawingPanel scrollPanel
      Scroll panel that holding the all the control components.
    • stdBehavior

      private com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior stdBehavior
      Standard behavior reference.
    • stdButton

      private JRadioButton stdButton
      Standard behavior button.
    • stdText

      private String stdText
      User message explain how the mouse moves in stardard mode.
    • time

      private long time
      Standard mouse tread waiting time.
    • velocitySlider

      private JSlider velocitySlider
      fly Speed control slider.
  • Constructor Details

    • JPanelView

      public JPanelView(RenderViewBase parent)
      Constructs a new dialog for controlling the view of the renderer.
      Parameters:
      parent - The parent frame that contains the image scene information.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Executes the following actions depending on what called this method:
      • Fly - changes the view platform to fly mode, so that the left mouse button is zoom, the right mouse button is translate, and the middle mouse button is pitch and roll.
      • Standard - changes the view platform back to the standard, with the left mouse button grabbing the object and rotating it and the left mouse button with the alt mask doing a zoom.
      • Reset - resets the view to what it was when the user called up this dialog.
      Specified by:
      actionPerformed in interface ActionListener
      Specified by:
      actionPerformed in class JPanelRendererBase
      Parameters:
      e - DOCUMENT ME!
    • disposeLocal

      public void disposeLocal(boolean flag)
      Clear memory.
      Parameters:
      flag - if true then super.disposeLocal() is called
    • getMainPanel

      public JPanel getMainPanel()
      Returns the contentPane of this dialog.
      Specified by:
      getMainPanel in class JPanelRendererBase
      Returns:
      DOCUMENT ME!
    • getMouseMode

      public int getMouseMode()
      Accessor that returns the current mouse mode of the dialog.
      Returns:
      Standard mode or fly mode.
    • mouseClicked

      public void mouseClicked(MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseEntered

      public void mouseEntered(MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseExited

      public void mouseExited(MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mousePressed

      public void mousePressed(MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      event - Original mouse event.
    • resizePanel

      public void resizePanel(int panelWidth, int frameHeight)
      Resize the control panel with ViewJFrameVolumeView's frame width and height.
      Overrides:
      resizePanel in class JPanelRendererBase
      Parameters:
      panelWidth - int width
      frameHeight - int height
    • setFlyEnabled

      public void setFlyEnabled(boolean flag)
      Sets the elements associated with "fly" behavior to be enabled or disabled, depending on flag.
      Parameters:
      flag - true indicates that these elements should be enabled, false that they should be disabled.
    • setMouseMode

      public void setMouseMode(int mod)
      Accessor that sets the current mouse mode of the dialog.
      Parameters:
      mod - Standard mode or fly mode.
    • stateChanged

      public void stateChanged(ChangeEvent event)
      Listens for changes in the velocity slider. If the user changes the velocity, it is changed within the parent class of FlyBehavior.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      event - Event that triggered this method.
    • finalize

      protected void finalize() throws Throwable
      Calls finalize.
      Overrides:
      finalize in class JPanelRendererBase
      Throws:
      Throwable - DOCUMENT ME!
    • createMouseControlPanel

      private JPanel createMouseControlPanel()
      Creates the mouse control panels. There are four arrows for each mouse button, left, right, and middle.
      Returns:
      The panel containing the mouse controls.
    • init

      private void init()
      Initializes the GUI components.
    • setButtonProps

      private void setButtonProps(JButton button, String tip)
      Sets the button properties for all the arrow buttons.
      Parameters:
      button - Button whose properties need to be set.
      tip - Tool tip text to associate with this button.
    • setIcon

      private void setIcon(Object source, boolean press)
      Sets the pressed or unpressed icon for the button, depending on which type it is.
      Parameters:
      source - The button that was pressed or released.
      press - true indicates the button was pressed, false that it was released.
    • translateEvent

      private MouseEvent translateEvent(MouseEvent event)
      Translates the mouse event received from the mouse control buttons to its equivalent on the canvas.
      Parameters:
      event - Original mouse event.
      Returns:
      Translated mouse event, with new source, x, y, and button mask.