Class JPanelView
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.surfaceview.JPanelView
- All Implemented Interfaces:
ActionListener,FocusListener,ItemListener,KeyListener,MouseListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classHelper class which sets the appropriate icons for the down button.(package private) classWrapper in order to hold the control panel layout in the JScrollPane.(package private) classHelper class which sets the appropriate icons for the left button.(package private) classHelper class which sets the appropriate icons for the right button.(package private) classClass used to send Standard mouse events to the canvas.(package private) classHelper class which sets the appropriate icons for the up button.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFly through viewing mode.private FlyBehaviorRendererFly behavior reference.private JRadioButtonFly behaviro radio button.private StringUser message explain how the mouse moves in fly mode.private JLabel[]speed control slider labels.private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonArrow button references.private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private intCurrent behavior mode.private ButtonGroupRadio button group reference.private JTextAreaText field reference that hold the user message.private PointerBehaviorRendererPointer behavior reference, not used now.private booleanFlag to indicate mouse pressed or not.static final intPointer viewing mode.private JRadioButtonPoint behavior button.private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JScrollPaneThe scroll pane holding the panel content.private JPanelView.DrawingPanelScroll panel that holding the all the control components.private static final longUse serialVersionUID for interoperability.static final intStardard viewing mode.private com.sun.j3d.utils.behaviors.vp.ViewPlatformBehaviorStandard behavior reference.private JRadioButtonStandard behavior button.private StringUser message explain how the mouse moves in stardard mode.private longStandard mouse tread waiting time.private JSliderfly Speed control slider.Fields inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
rayBasedRender, renderBaseFields inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
applyButton, cancelButton, cancelFlag, closeButton, helpButton, isActiveImage, mainPanel, NEW, OKButton, REPLACE, runInSeparateThread, serif12, serif12BFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionJPanelView(RenderViewBase parent) Constructs a new dialog for controlling the view of the renderer. -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes 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.private JPanelCreates the mouse control panels.voiddisposeLocal(boolean flag) Clear memory.protected voidfinalize()Calls finalize.Returns the contentPane of this dialog.intAccessor that returns the current mouse mode of the dialog.private voidinit()Initializes the GUI components.voidmouseClicked(MouseEvent event) Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseEntered(MouseEvent event) Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseExited(MouseEvent event) Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmousePressed(MouseEvent event) Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidmouseReleased(MouseEvent event) Translates the event to the appropriate version on the canvas, then sends it to the canvas.voidresizePanel(int panelWidth, int frameHeight) Resize the control panel with ViewJFrameVolumeView's frame width and height.private voidsetButtonProps(JButton button, String tip) Sets the button properties for all the arrow buttons.voidsetFlyEnabled(boolean flag) Sets the elements associated with "fly" behavior to be enabled or disabled, depending onflag.private voidSets the pressed or unpressed icon for the button, depending on which type it is.voidsetMouseMode(int mod) Accessor that sets the current mouse mode of the dialog.voidstateChanged(ChangeEvent event) Listens for changes in the velocity slider.private MouseEventtranslateEvent(MouseEvent event) Translates the mouse event received from the mouse control buttons to its equivalent on the canvas.Methods inherited from class gov.nih.mipav.view.renderer.J3D.JPanelRendererJ3D
disposeLocal, getSurfaceRender, setRayBasedRender, setSurfaceRenderMethods inherited from class gov.nih.mipav.view.renderer.JPanelRendererBase
buildApplyButton, buildCancelButton, buildCloseButton, buildHelpButton, buildOKButton, buildTitledBorder, focusGained, focusLost, isCancelled, itemStateChanged, keyPressed, keyReleased, keyTyped, makeString, setLeftHandSystem, setVisible, setVisibleStandard, setWCSystem, testParameterMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.event.FocusListener
focusGained, focusLostMethods inherited from interface java.awt.event.ItemListener
itemStateChangedMethods inherited from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
STD_MODE
public static final int STD_MODEStardard viewing mode.- See Also:
-
FLY_MODE
public static final int FLY_MODEFly through viewing mode.- See Also:
-
PTR_MODE
public static final int PTR_MODEPointer viewing mode.- See Also:
-
flyBehavior
Fly behavior reference. -
flyButton
Fly behaviro radio button. -
flyText
User message explain how the mouse moves in fly mode. -
labels
speed control slider labels. -
leftDownButton
DOCUMENT ME! -
leftLeftButton
DOCUMENT ME! -
leftRightButton
DOCUMENT ME! -
leftUpButton
Arrow button references. -
middleDownButton
DOCUMENT ME! -
middleLeftButton
DOCUMENT ME! -
middleRightButton
DOCUMENT ME! -
middleUpButton
DOCUMENT ME! -
mode
private int modeCurrent behavior mode. -
modeGroup
Radio button group reference. -
mouseText
Text field reference that hold the user message. -
pointerBehavior
Pointer behavior reference, not used now. -
pressed
private boolean pressedFlag to indicate mouse pressed or not. -
ptrButton
Point behavior button. -
rightDownButton
DOCUMENT ME! -
rightLeftButton
DOCUMENT ME! -
rightRightButton
DOCUMENT ME! -
rightUpButton
DOCUMENT ME! -
scroller
The scroll pane holding the panel content. Useful when the screen is small. -
scrollPanel
Scroll panel that holding the all the control components. -
stdBehavior
private com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior stdBehaviorStandard behavior reference. -
stdButton
Standard behavior button. -
stdText
User message explain how the mouse moves in stardard mode. -
time
private long timeStandard mouse tread waiting time. -
velocitySlider
fly Speed control slider.
-
-
Constructor Details
-
JPanelView
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
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:
actionPerformedin interfaceActionListener- Specified by:
actionPerformedin classJPanelRendererBase- Parameters:
e- DOCUMENT ME!
-
disposeLocal
public void disposeLocal(boolean flag) Clear memory.- Parameters:
flag- if true then super.disposeLocal() is called
-
getMainPanel
Returns the contentPane of this dialog.- Specified by:
getMainPanelin classJPanelRendererBase- Returns:
- DOCUMENT ME!
-
getMouseMode
public int getMouseMode()Accessor that returns the current mouse mode of the dialog.- Returns:
- Standard mode or fly mode.
-
mouseClicked
Translates the event to the appropriate version on the canvas, then sends it to the canvas.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseEntered
Translates the event to the appropriate version on the canvas, then sends it to the canvas.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseExited
Translates the event to the appropriate version on the canvas, then sends it to the canvas.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mousePressed
Translates the event to the appropriate version on the canvas, then sends it to the canvas.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseReleased
Translates the event to the appropriate version on the canvas, then sends it to the canvas.- Specified by:
mouseReleasedin interfaceMouseListener- 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:
resizePanelin classJPanelRendererBase- Parameters:
panelWidth- int widthframeHeight- int height
-
setFlyEnabled
public void setFlyEnabled(boolean flag) Sets the elements associated with "fly" behavior to be enabled or disabled, depending onflag.- Parameters:
flag-trueindicates that these elements should be enabled,falsethat 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
Listens for changes in the velocity slider. If the user changes the velocity, it is changed within the parent class of FlyBehavior.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
event- Event that triggered this method.
-
finalize
Calls finalize.- Overrides:
finalizein classJPanelRendererBase- Throws:
Throwable- DOCUMENT ME!
-
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
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
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.
-
translateEvent
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.
-