Package gov.nih.mipav.view.renderer.J3D
Class JPanelCamera
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- gov.nih.mipav.view.renderer.JPanelRendererBase
-
- gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
-
- gov.nih.mipav.view.renderer.J3D.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) classJPanelCamera.DownButtonHelper class which sets the appropriate icons for the down button.(package private) classJPanelCamera.DrawingPanelWrapper in order to hold the control panel layout in the JScrollPane.(package private) classJPanelCamera.EmptyButtonHelper class which create the empty button.(package private) classJPanelCamera.LeftButtonHelper class which sets the appropriate icons for the left button.(package private) classJPanelCamera.RightButtonHelper class which sets the appropriate icons for the right button.(package private) classJPanelCamera.StandardMouseClass used to send Standard mouse events to the canvas.(package private) classJPanelCamera.UpButtonHelper 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
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JPanelbuttonPanelButton panel.private javax.swing.JLabeldegreeLabelLabel of the rotation degree.private javax.swing.JTextFielddegreeTextTextfield of the roation degree.static intFLY_MODEFly mode of the camera manually snapshooting.private javax.swing.JRadioButtonflyButtonRaido Button group.private javax.swing.JLabellabelXX, Y, Z labels inside the rotation panel.private javax.swing.JLabellabelYX, Y, Z labels inside the rotation panel.private javax.swing.JLabellabelZX, Y, Z labels inside the rotation panel.private javax.swing.JButtonleftDownButtonLeft panel mouse button down.private javax.swing.JButtonleftDownButtonEmptyLeft panel empty button.private javax.swing.JButtonleftLeftButtonLeft panel mouse button left.private javax.swing.JButtonleftRightButtonLeft panel mouse button right.private javax.swing.JButtonleftUpButtonLeft panel mouse button up.private javax.swing.JButtonleftUpButtonEmptyEmpty button group.private javax.swing.JButtonmiddleDownButtonMiddle panel down button.private javax.swing.JButtonmiddleLeftButtonMiddel panel left button.private javax.swing.JButtonmiddleLeftButtonEmptyMiddle panel empty button.private javax.swing.JButtonmiddleRightButtonMiddle panel right button.private javax.swing.JButtonmiddleRightButtonEmptyMiddle panel right button empty.private javax.swing.JButtonmiddleUpButtonMiddel panel up button.private intmodeCurrent mode std or fly.private javax.swing.JPanelmousePanelPanel holds the mouse move buttons.private RenderViewBaseparentSceneParent frame.private booleanpressedIf any of the mouse move button pressed.private javax.swing.JRadioButtonradioXRadio button of the X_AXIS mode option.private javax.swing.JRadioButtonradioYRadio button of the Y_AXIS mode option.private javax.swing.JRadioButtonradioZRadio button of the Z_AXIS mode option.private javax.swing.JButtonresetButtonReset button.private javax.swing.JButtonrightDownButtonRight panel down button.private javax.swing.JButtonrightLeftButtonRight panel left button.private javax.swing.JButtonrightRightButtonRight panel right button.private javax.swing.JButtonrightUpButtonRight panel up button.private javax.swing.JScrollPanescrollerScroll pane.private JPanelCamera.DrawingPanelscrollPanelScroll panel that holding the all the control components.private static longserialVersionUIDUse serialVersionUID for interoperability.private javax.swing.JButtonsnapButtonCamera button.private javax.swing.JButtonstartButtonStart button to auto snapshooting.static intSTD_MODEStardard mode of the camera auto snapshooting.private javax.swing.JRadioButtonstdButtonAuto snapshot button.private longtimeTime to wait for the next mouse event.-
Fields inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
rayBasedRender, renderBase
-
Fields inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
applyButton, cancelButton, cancelFlag, closeButton, helpButton, isActiveImage, mainPanel, NEW, OKButton, REPLACE, runInSeparateThread, serif12, serif12B
-
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
-
-
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 voidactionPerformed(java.awt.event.ActionEvent event)Closes dialog box when the OK button is pressed and sets the variables.private javax.swing.JPanelbuildMouseControlPanel()Creates the mouse control panels.private javax.swing.JButtonbuildResetButton()Build the reset button.private javax.swing.JButtonbuildStartButton()Builds the cancel button.voiddisposeLocal(boolean flag)Clear memory.protected voidfinalize()finalize - calls dispose.javax.swing.JPanelgetMainPanel()Sets up the GUI (panels, buttons, etc) and displays it on the screen.private voidinit()Sets up the GUI (panels, buttons, etc) and displays it on the screen.voiditemStateChanged(java.awt.event.ItemEvent event)Sets the flags for the checkboxes and resets labels.voidmouseClicked(java.awt.event.MouseEvent event)Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseEntered(java.awt.event.MouseEvent event)Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseExited(java.awt.event.MouseEvent event)Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmousePressed(java.awt.event.MouseEvent event)Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseReleased(java.awt.event.MouseEvent event)Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidresizePanel(int panelWidth, int frameHeight)Resizig the control panel with ViewJFrameVolumeView's frame width and height.private voidsetButtonProps(javax.swing.JButton button, java.lang.String tip)Sets the button properties for all the arrow buttons.voidsetDegree(boolean positive)Set the image rotation angle.private voidsetFlyEnabled(boolean flag)Enable manual snapshot buttons.private voidsetIcon(java.lang.Object source, boolean press)Sets the pressed or unpressed icon for the button, depending on which type it is.private voidsetStdEnabled(boolean flag)Enable auto snapshot buttons.protected booleantestParameter(java.lang.String str, double minValue, double maxValue)Tests that the entered parameter is in range.-
Methods inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
disposeLocal, getSurfaceRender, setRayBasedRender, setSurfaceRender
-
Methods inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
buildApplyButton, buildCancelButton, buildCloseButton, buildHelpButton, buildOKButton, buildTitledBorder, focusGained, focusLost, isCancelled, keyPressed, keyReleased, keyTyped, makeString, setLeftHandSystem, setVisible, setVisibleStandard, setWCSystem
-
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
-
-
-
-
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.
-
parentScene
private RenderViewBase parentScene
Parent frame.
-
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.
-
scrollPanel
private JPanelCamera.DrawingPanel scrollPanel
Scroll panel that holding the all the control components.
-
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:
actionPerformedin interfacejava.awt.event.ActionListener- Specified by:
actionPerformedin classJPanelRendererBase- 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:
getMainPanelin classJPanelRendererBase- 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:
itemStateChangedin interfacejava.awt.event.ItemListener- Overrides:
itemStateChangedin classJPanelRendererBase- 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:
mouseClickedin interfacejava.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:
mouseEnteredin interfacejava.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:
mouseExitedin interfacejava.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:
mousePressedin interfacejava.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:
mouseReleasedin interfacejava.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:
resizePanelin classJPanelRendererBase- 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.Throwablefinalize - calls dispose.- Overrides:
finalizein classJPanelRendererBase- 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:
testParameterin classJPanelRendererBase- 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.
-
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-truemeans turn on,falsemeans 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-trueindicates the button was pressed,falsethat it was released.
-
setStdEnabled
private void setStdEnabled(boolean flag)
Enable auto snapshot buttons.- Parameters:
flag-truemeans turn on,falsemeans turn off.
-
-