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:
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
,javax.swing.event.ChangeListener
public class JPanelView extends JPanelRendererJ3D implements javax.swing.event.ChangeListener, java.awt.event.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
JPanelView.DownButton
Helper class which sets the appropriate icons for the down button.(package private) class
JPanelView.DrawingPanel
Wrapper in order to hold the control panel layout in the JScrollPane.(package private) class
JPanelView.LeftButton
Helper class which sets the appropriate icons for the left button.(package private) class
JPanelView.RightButton
Helper class which sets the appropriate icons for the right button.(package private) class
JPanelView.StandardMouse
Class used to send Standard mouse events to the canvas.(package private) class
JPanelView.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
-
-
Field Summary
Fields Modifier and Type Field Description static int
FLY_MODE
Fly through viewing mode.private FlyBehaviorRenderer
flyBehavior
Fly behavior reference.private javax.swing.JRadioButton
flyButton
Fly behaviro radio button.private java.lang.String
flyText
User message explain how the mouse moves in fly mode.private javax.swing.JLabel[]
labels
speed control slider labels.private javax.swing.JButton
leftDownButton
DOCUMENT ME!private javax.swing.JButton
leftLeftButton
DOCUMENT ME!private javax.swing.JButton
leftRightButton
DOCUMENT ME!private javax.swing.JButton
leftUpButton
Arrow button references.private javax.swing.JButton
middleDownButton
DOCUMENT ME!private javax.swing.JButton
middleLeftButton
DOCUMENT ME!private javax.swing.JButton
middleRightButton
DOCUMENT ME!private javax.swing.JButton
middleUpButton
DOCUMENT ME!private int
mode
Current behavior mode.private javax.swing.ButtonGroup
modeGroup
Radio button group reference.private javax.swing.JTextArea
mouseText
Text field reference that hold the user message.private PointerBehaviorRenderer
pointerBehavior
Pointer behavior reference, not used now.private boolean
pressed
Flag to indicate mouse pressed or not.static int
PTR_MODE
Pointer viewing mode.private javax.swing.JRadioButton
ptrButton
Point behavior button.private javax.swing.JButton
rightDownButton
DOCUMENT ME!private javax.swing.JButton
rightLeftButton
DOCUMENT ME!private javax.swing.JButton
rightRightButton
DOCUMENT ME!private javax.swing.JButton
rightUpButton
DOCUMENT ME!private javax.swing.JScrollPane
scroller
The scroll pane holding the panel content.private JPanelView.DrawingPanel
scrollPanel
Scroll panel that holding the all the control components.private static long
serialVersionUID
Use serialVersionUID for interoperability.static int
STD_MODE
Stardard viewing mode.private com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
stdBehavior
Standard behavior reference.private javax.swing.JRadioButton
stdButton
Standard behavior button.private java.lang.String
stdText
User message explain how the mouse moves in stardard mode.private long
time
Standard mouse tread waiting time.private javax.swing.JSlider
velocitySlider
fly Speed control slider.-
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 JPanelView(RenderViewBase parent)
Constructs a new dialog for controlling the view of the renderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.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.private javax.swing.JPanel
createMouseControlPanel()
Creates the mouse control panels.void
disposeLocal(boolean flag)
Clear memory.protected void
finalize()
Calls finalize.javax.swing.JPanel
getMainPanel()
Returns the contentPane of this dialog.int
getMouseMode()
Accessor that returns the current mouse mode of the dialog.private void
init()
Initializes the GUI components.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)
Resize 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
setFlyEnabled(boolean flag)
Sets the elements associated with "fly" behavior to be enabled or disabled, depending onflag
.private void
setIcon(java.lang.Object source, boolean press)
Sets the pressed or unpressed icon for the button, depending on which type it is.void
setMouseMode(int mod)
Accessor that sets the current mouse mode of the dialog.void
stateChanged(javax.swing.event.ChangeEvent event)
Listens for changes in the velocity slider.private java.awt.event.MouseEvent
translateEvent(java.awt.event.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, setSurfaceRender
-
Methods 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, testParameter
-
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 viewing mode.- See Also:
- Constant Field Values
-
FLY_MODE
public static final int FLY_MODE
Fly through viewing mode.- See Also:
- Constant Field Values
-
PTR_MODE
public static final int PTR_MODE
Pointer viewing mode.- See Also:
- Constant Field Values
-
flyBehavior
private FlyBehaviorRenderer flyBehavior
Fly behavior reference.
-
flyButton
private javax.swing.JRadioButton flyButton
Fly behaviro radio button.
-
flyText
private java.lang.String flyText
User message explain how the mouse moves in fly mode.
-
labels
private javax.swing.JLabel[] labels
speed control slider labels.
-
leftDownButton
private javax.swing.JButton leftDownButton
DOCUMENT ME!
-
leftLeftButton
private javax.swing.JButton leftLeftButton
DOCUMENT ME!
-
leftRightButton
private javax.swing.JButton leftRightButton
DOCUMENT ME!
-
leftUpButton
private javax.swing.JButton leftUpButton
Arrow button references.
-
middleDownButton
private javax.swing.JButton middleDownButton
DOCUMENT ME!
-
middleLeftButton
private javax.swing.JButton middleLeftButton
DOCUMENT ME!
-
middleRightButton
private javax.swing.JButton middleRightButton
DOCUMENT ME!
-
middleUpButton
private javax.swing.JButton middleUpButton
DOCUMENT ME!
-
mode
private int mode
Current behavior mode.
-
modeGroup
private javax.swing.ButtonGroup modeGroup
Radio button group reference.
-
mouseText
private javax.swing.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 javax.swing.JRadioButton ptrButton
Point behavior button.
-
rightDownButton
private javax.swing.JButton rightDownButton
DOCUMENT ME!
-
rightLeftButton
private javax.swing.JButton rightLeftButton
DOCUMENT ME!
-
rightRightButton
private javax.swing.JButton rightRightButton
DOCUMENT ME!
-
rightUpButton
private javax.swing.JButton rightUpButton
DOCUMENT ME!
-
scroller
private javax.swing.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 javax.swing.JRadioButton stdButton
Standard behavior button.
-
stdText
private java.lang.String stdText
User message explain how the mouse moves in stardard mode.
-
time
private long time
Standard mouse tread waiting time.
-
velocitySlider
private javax.swing.JSlider velocitySlider
fly Speed control slider.
-
-
Constructor Detail
-
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 Detail
-
actionPerformed
public void actionPerformed(java.awt.event.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 interfacejava.awt.event.ActionListener
- Specified by:
actionPerformed
in classJPanelRendererBase
- Parameters:
e
- DOCUMENT ME!
-
disposeLocal
public void disposeLocal(boolean flag)
Clear memory.- Parameters:
flag
- if true then super.disposeLocal() is called
-
getMainPanel
public javax.swing.JPanel getMainPanel()
Returns the contentPane of this dialog.- Specified by:
getMainPanel
in 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
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 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:
mouseEntered
in 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:
mouseExited
in 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:
mousePressed
in 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:
mouseReleased
in interfacejava.awt.event.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 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
-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(javax.swing.event.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 interfacejavax.swing.event.ChangeListener
- Parameters:
event
- Event that triggered this method.
-
finalize
protected void finalize() throws java.lang.Throwable
Calls finalize.- Overrides:
finalize
in classJPanelRendererBase
- Throws:
java.lang.Throwable
- DOCUMENT ME!
-
createMouseControlPanel
private javax.swing.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(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.
-
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.
-
translateEvent
private java.awt.event.MouseEvent translateEvent(java.awt.event.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.
-
-