Class JPanelCamera

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

    public class JPanelCamera
    extends JPanelRendererJ3D
    implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.ItemListener
    JPanelCamera creates the camera control panel for the 3D visulization frame. The basic functionalities include auto and manual snapshot 3D images, and create a film clip from the captuered 3D images.
    Version:
    0.1 May, 2003
    Author:
    Matthew J. McAuliffe, Ph.D., Ruida Cheng
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  JPanelCamera.DownButton
      Helper class which sets the appropriate icons for the down button.
      (package private) class  JPanelCamera.DrawingPanel
      Wrapper in order to hold the control panel layout in the JScrollPane.
      (package private) class  JPanelCamera.EmptyButton
      Helper class which create the empty button.
      (package private) class  JPanelCamera.LeftButton
      Helper class which sets the appropriate icons for the left button.
      (package private) class  JPanelCamera.RightButton
      Helper class which sets the appropriate icons for the right button.
      (package private) class  JPanelCamera.StandardMouse
      Class used to send Standard mouse events to the canvas.
      (package private) class  JPanelCamera.UpButton
      Helper class which sets the appropriate icons for the up button.
      • 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
      private javax.swing.JPanel buttonPanel
      Button panel.
      private javax.swing.JLabel degreeLabel
      Label of the rotation degree.
      private javax.swing.JTextField degreeText
      Textfield of the roation degree.
      static int FLY_MODE
      Fly mode of the camera manually snapshooting.
      private javax.swing.JRadioButton flyButton
      Raido Button group.
      private javax.swing.JLabel labelX
      X, Y, Z labels inside the rotation panel.
      private javax.swing.JLabel labelY
      X, Y, Z labels inside the rotation panel.
      private javax.swing.JLabel labelZ
      X, Y, Z labels inside the rotation panel.
      private javax.swing.JButton leftDownButton
      Left panel mouse button down.
      private javax.swing.JButton leftDownButtonEmpty
      Left panel empty button.
      private javax.swing.JButton leftLeftButton
      Left panel mouse button left.
      private javax.swing.JButton leftRightButton
      Left panel mouse button right.
      private javax.swing.JButton leftUpButton
      Left panel mouse button up.
      private javax.swing.JButton leftUpButtonEmpty
      Empty button group.
      private javax.swing.JButton middleDownButton
      Middle panel down button.
      private javax.swing.JButton middleLeftButton
      Middel panel left button.
      private javax.swing.JButton middleLeftButtonEmpty
      Middle panel empty button.
      private javax.swing.JButton middleRightButton
      Middle panel right button.
      private javax.swing.JButton middleRightButtonEmpty
      Middle panel right button empty.
      private javax.swing.JButton middleUpButton
      Middel panel up button.
      private int mode
      Current mode std or fly.
      private javax.swing.JPanel mousePanel
      Panel holds the mouse move buttons.
      private RenderViewBase parentScene
      Parent frame.
      private boolean pressed
      If any of the mouse move button pressed.
      private javax.swing.JRadioButton radioX
      Radio button of the X_AXIS mode option.
      private javax.swing.JRadioButton radioY
      Radio button of the Y_AXIS mode option.
      private javax.swing.JRadioButton radioZ
      Radio button of the Z_AXIS mode option.
      private javax.swing.JButton resetButton
      Reset button.
      private javax.swing.JButton rightDownButton
      Right panel down button.
      private javax.swing.JButton rightLeftButton
      Right panel left button.
      private javax.swing.JButton rightRightButton
      Right panel right button.
      private javax.swing.JButton rightUpButton
      Right panel up button.
      private javax.swing.JScrollPane scroller
      Scroll pane.
      private JPanelCamera.DrawingPanel scrollPanel
      Scroll panel that holding the all the control components.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private javax.swing.JButton snapButton
      Camera button.
      private javax.swing.JButton startButton
      Start button to auto snapshooting.
      static int STD_MODE
      Stardard mode of the camera auto snapshooting.
      private javax.swing.JRadioButton stdButton
      Auto snapshot button.
      private long time
      Time to wait for the next mouse event.
      • 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
      JPanelCamera​(RenderViewBase theParentFrame)
      Creates new dialog for converting type of image.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent event)
      Closes dialog box when the OK button is pressed and sets the variables.
      private javax.swing.JPanel buildMouseControlPanel()
      Creates the mouse control panels.
      private javax.swing.JButton buildResetButton()
      Build the reset button.
      private javax.swing.JButton buildStartButton()
      Builds the cancel button.
      void disposeLocal​(boolean flag)
      Clear memory.
      protected void finalize()
      finalize - calls dispose.
      javax.swing.JPanel getMainPanel()
      Sets up the GUI (panels, buttons, etc) and displays it on the screen.
      private void init()
      Sets up the GUI (panels, buttons, etc) and displays it on the screen.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Sets the flags for the checkboxes and resets labels.
      void mouseClicked​(java.awt.event.MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      void mouseEntered​(java.awt.event.MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      void mouseExited​(java.awt.event.MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      void mousePressed​(java.awt.event.MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      void mouseReleased​(java.awt.event.MouseEvent event)
      Translates the event to the appropriate version on the canvas, then sends it to the canvas.
      void resizePanel​(int panelWidth, int frameHeight)
      Resizig the control panel with ViewJFrameVolumeView's frame width and height.
      private void setButtonProps​(javax.swing.JButton button, java.lang.String tip)
      Sets the button properties for all the arrow buttons.
      void setDegree​(boolean positive)
      Set the image rotation angle.
      private void setFlyEnabled​(boolean flag)
      Enable manual snapshot buttons.
      private void setIcon​(java.lang.Object source, boolean press)
      Sets the pressed or unpressed icon for the button, depending on which type it is.
      private void setStdEnabled​(boolean flag)
      Enable auto snapshot buttons.
      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
      • Methods inherited from interface java.awt.event.FocusListener

        focusGained, focusLost
      • Methods inherited from interface java.awt.event.KeyListener

        keyPressed, keyReleased, keyTyped
    • Field Detail

      • serialVersionUID

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

        public static final int STD_MODE
        Stardard mode of the camera auto snapshooting.
        See Also:
        Constant Field Values
      • FLY_MODE

        public static final int FLY_MODE
        Fly mode of the camera manually snapshooting.
        See Also:
        Constant Field Values
      • buttonPanel

        private javax.swing.JPanel buttonPanel
        Button panel.
      • degreeLabel

        private javax.swing.JLabel degreeLabel
        Label of the rotation degree.
      • degreeText

        private javax.swing.JTextField degreeText
        Textfield of the roation degree.
      • flyButton

        private javax.swing.JRadioButton flyButton
        Raido Button group.
      • labelX

        private javax.swing.JLabel labelX
        X, Y, Z labels inside the rotation panel.
      • labelY

        private javax.swing.JLabel labelY
        X, Y, Z labels inside the rotation panel.
      • labelZ

        private javax.swing.JLabel labelZ
        X, Y, Z labels inside the rotation panel.
      • leftDownButton

        private javax.swing.JButton leftDownButton
        Left panel mouse button down.
      • leftDownButtonEmpty

        private javax.swing.JButton leftDownButtonEmpty
        Left panel empty button.
      • leftLeftButton

        private javax.swing.JButton leftLeftButton
        Left panel mouse button left.
      • leftRightButton

        private javax.swing.JButton leftRightButton
        Left panel mouse button right.
      • leftUpButton

        private javax.swing.JButton leftUpButton
        Left panel mouse button up.
      • leftUpButtonEmpty

        private javax.swing.JButton leftUpButtonEmpty
        Empty button group.
      • middleDownButton

        private javax.swing.JButton middleDownButton
        Middle panel down button.
      • middleLeftButton

        private javax.swing.JButton middleLeftButton
        Middel panel left button.
      • middleLeftButtonEmpty

        private javax.swing.JButton middleLeftButtonEmpty
        Middle panel empty button.
      • middleRightButton

        private javax.swing.JButton middleRightButton
        Middle panel right button.
      • middleRightButtonEmpty

        private javax.swing.JButton middleRightButtonEmpty
        Middle panel right button empty.
      • middleUpButton

        private javax.swing.JButton middleUpButton
        Middel panel up button.
      • mode

        private int mode
        Current mode std or fly.
      • mousePanel

        private javax.swing.JPanel mousePanel
        Panel holds the mouse move buttons.
      • pressed

        private boolean pressed
        If any of the mouse move button pressed.
      • radioX

        private javax.swing.JRadioButton radioX
        Radio button of the X_AXIS mode option.
      • radioY

        private javax.swing.JRadioButton radioY
        Radio button of the Y_AXIS mode option.
      • radioZ

        private javax.swing.JRadioButton radioZ
        Radio button of the Z_AXIS mode option.
      • resetButton

        private javax.swing.JButton resetButton
        Reset button.
      • rightDownButton

        private javax.swing.JButton rightDownButton
        Right panel down button.
      • rightLeftButton

        private javax.swing.JButton rightLeftButton
        Right panel left button.
      • rightRightButton

        private javax.swing.JButton rightRightButton
        Right panel right button.
      • rightUpButton

        private javax.swing.JButton rightUpButton
        Right panel up button.
      • scroller

        private javax.swing.JScrollPane scroller
        Scroll pane.
      • snapButton

        private javax.swing.JButton snapButton
        Camera button.
      • startButton

        private javax.swing.JButton startButton
        Start button to auto snapshooting.
      • stdButton

        private javax.swing.JRadioButton stdButton
        Auto snapshot button.
      • time

        private long time
        Time to wait for the next mouse event.
    • Constructor Detail

      • JPanelCamera

        public JPanelCamera​(RenderViewBase theParentFrame)
        Creates new dialog for converting type of image.
        Parameters:
        theParentFrame - Parent frame.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent event)
        Closes dialog box when the OK button is pressed and sets the variables.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Specified by:
        actionPerformed in class JPanelRendererBase
        Parameters:
        event - Event that triggers this function
      • disposeLocal

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

        public javax.swing.JPanel getMainPanel()
        Sets up the GUI (panels, buttons, etc) and displays it on the screen.
        Specified by:
        getMainPanel in class JPanelRendererBase
        Returns:
        JPanel the main control panel
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Sets the flags for the checkboxes and resets labels.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Overrides:
        itemStateChanged in class JPanelRendererBase
        Parameters:
        event - Event that triggered this function.
      • mouseClicked

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

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

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

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

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

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

        public void setDegree​(boolean positive)
        Set the image rotation angle.
        Parameters:
        positive - rotate counter clock wise or not.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        finalize - calls dispose.
        Overrides:
        finalize in class JPanelRendererBase
        Throws:
        java.lang.Throwable - Call disposeLocal to free memory.
      • testParameter

        protected boolean testParameter​(java.lang.String str,
                                        double minValue,
                                        double maxValue)
        Tests that the entered parameter is in range.
        Overrides:
        testParameter in class JPanelRendererBase
        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.
      • buildMouseControlPanel

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

        private javax.swing.JButton buildResetButton()
        Build the reset button.
        Returns:
        resetButton reset button.
      • buildStartButton

        private javax.swing.JButton buildStartButton()
        Builds the cancel button. Sets it internally as well return the just-built button.
        Returns:
        Return the auto snapshot button.
      • init

        private void init()
        Sets up the GUI (panels, buttons, etc) and displays it on the screen.
      • setButtonProps

        private void setButtonProps​(javax.swing.JButton button,
                                    java.lang.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.
      • setFlyEnabled

        private void setFlyEnabled​(boolean flag)
        Enable manual snapshot buttons.
        Parameters:
        flag - true means turn on, false means turn off.
      • setIcon

        private void setIcon​(java.lang.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.
      • setStdEnabled

        private void setStdEnabled​(boolean flag)
        Enable auto snapshot buttons.
        Parameters:
        flag - true means turn on, false means turn off.