Package gov.nih.mipav.view.renderer.J3D
Class JPanelLights
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.JPanelLights
- All Implemented Interfaces:
ActionListener,FocusListener,ItemListener,KeyListener,MouseListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,ListSelectionListener
public class JPanelLights
extends JPanelRendererJ3D
implements ChangeListener, MouseListener, ListSelectionListener
Dialog to turn slices bounding box of surface renderer on and off, and to change the color of the frame. This dialog
also control the X, Y, Z slices movements.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classCancel the color dialog, change nothing.(package private) classPick up the selected color and call method to change the surface color.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 TypeFieldDescriptionprivate JRadioButtonRadio button for different light type.private booleanFlag is set if one of the controls changed a value and the renderering needs to be redrawn when the mouse is released.private JCheckBoxCheck box to show the light bulb or not.private JButtonColor button, checkBox On/Off.private ViewJColorChooserColor choose dialog reference.private JLabelColor label.private JPanelControl panel.private BoxControl panel box that hold the control panel.private JRadioButtonDirectional light radio botton.private JPanelScroll panel reference.private JSliderIntensity slider.private intindex of currently selected one.private JLabelLight intensity label.private JLabelLight intensity label begin.private JLabelLight intensity label end.private JLabelLight intensity label middle.private JLabelLight shinness label.private JLabelShinness label begin.private JLabelShinness label end.private JLabelShinness lable middle.static final intAmbient light index.static final intMax number of light.static final intlight for corner X0Y0Z0.static final intlight for corner X0Y0Z1.static final intlight for corner X0Y1Z0.static final intlight for corner X0Y1Z1.static final intlight for corner X1Y0Z0.static final intlight for corner X1Y0Z1.static final intlight for corner X1Y1Z0.static final intlight for corner X1Y1Z1.static final intStatic light index.private JListList of lights.private int[]Light scale factor array.private GeneralLight[]The structure for the light bulbs.private GeneralLight[]General light array.private SoftwareLight[]Soft light array.private SoftwareLight[]Lighting objects needed for software rendering.private GeneralLight[]World general light array.private VolumeTriPlanarRenderprivate JLabelLabel for slider X position.private JLabelLabel for slider Y position.private JLabelLabel for slider Z position.private JLabelLabel for X light target position.private JLabelLabel for Y light target position.private JLabelLabel for Z light target position.private JPanelSurfacesurface panel reference.private SurfaceRenderParent render frame reference.private JSliderLight x position slider.private JSliderLight y position slider.private JSliderLight z position slider.private JSliderLight x target position slider.private JSliderLight y target position slider.private JSliderLight z target position slider.private JTextFieldX position text field.private JTextFieldY position text field.private JTextFieldZ position text field.private JTextFieldX target position text field.private JTextFieldY target position text field.private JTextFieldZ target position text field.private floatx, y, z box size.private JCheckBoxLight turn on/off check box.private JLabelLight turn on/off label.private JRadioButtonPoint light radio button.private JScrollPaneScroll pane.private JPanelScroll the control panel when the frame changes size.private static final longUse serialVersionUID for interoperability.private JPanelShininess panel.private JSliderShininess slider.private JRadioButtonSpot light radio button.private JTextFieldLight intensity textfield.private JTextFieldLight shinness textfield.private floatx, y, z box size.private floatx, y, z box size.private floatx, y, z box size.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
ConstructorsConstructorDescriptionJPanelLights(JPanelSurface kPanelSurface, SurfaceRender kRenderSurface) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Changes color of slices box frame and button if color button was pressed; turns bounding box on and off if checkbox was pressed; and closes dialog if "Close" button was pressed.private voidaddControlPanel(JPanel panelControl, Component c, GridBagConstraints gbc, int x, int y, int w, int h) Helper method that adds components to the control panel for the grid bag layout.private voidBuild the light control panel.private voidBuild the light list panel.private voidBuild the shinness control panel.private JLabelcreateLabel(String title, boolean bEnable) Creates a label in the proper font and color.voiddisposeLocal(boolean flag) Clear memory and garbage collection.voidenableLight(int iSelect, boolean bOn) protected voidfinalize()Calls dispose.getGeneralLight(int iIndex) The the general light with the given index.Returns all general lights.Get the main control Panel.intGet the number of lights.Get the software light model.Get the software light world.voidmouseClicked(MouseEvent event) Unchanged.voidmouseEntered(MouseEvent event) Unchanged.voidmouseExited(MouseEvent event) Unchanged.voidmousePressed(MouseEvent event) Unchanged.voidmouseReleased(MouseEvent event) Used in MouseRecorder to stop one series of slide moves.voidRefresh the light control panel.voidRepaints the parent frame with the correct lighting.voidresizePanel(int panelWidth, int frameHeight) Resizig the control panel with ViewJFrameVolumeView's frame width and height.voidsetSelectedIndex(int index) Sets the light to selected.voidSlider move event handler.voidGet the current SoftwareLight instances from each of the GeneralLight instances -- for the world- and model-based lights.voidvalueChanged(ListSelectionEvent kEvent) Sets values of sliders and intensities appropriately based on which light was chosen in the list.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:
-
LIGHT_INDEX_STATIC
public static final int LIGHT_INDEX_STATICStatic light index.- See Also:
-
LIGHT_INDEX_AMBIENT
public static final int LIGHT_INDEX_AMBIENTAmbient light index.- See Also:
-
LIGHT_INDEX_MODEL_X0Y0Z0
public static final int LIGHT_INDEX_MODEL_X0Y0Z0light for corner X0Y0Z0.- See Also:
-
LIGHT_INDEX_MODEL_X1Y0Z0
public static final int LIGHT_INDEX_MODEL_X1Y0Z0light for corner X1Y0Z0.- See Also:
-
LIGHT_INDEX_MODEL_X0Y1Z0
public static final int LIGHT_INDEX_MODEL_X0Y1Z0light for corner X0Y1Z0.- See Also:
-
LIGHT_INDEX_MODEL_X1Y1Z0
public static final int LIGHT_INDEX_MODEL_X1Y1Z0light for corner X1Y1Z0.- See Also:
-
LIGHT_INDEX_MODEL_X0Y0Z1
public static final int LIGHT_INDEX_MODEL_X0Y0Z1light for corner X0Y0Z1.- See Also:
-
LIGHT_INDEX_MODEL_X1Y0Z1
public static final int LIGHT_INDEX_MODEL_X1Y0Z1light for corner X1Y0Z1.- See Also:
-
LIGHT_INDEX_MODEL_X0Y1Z1
public static final int LIGHT_INDEX_MODEL_X0Y1Z1light for corner X0Y1Z1.- See Also:
-
LIGHT_INDEX_MODEL_X1Y1Z1
public static final int LIGHT_INDEX_MODEL_X1Y1Z1light for corner X1Y1Z1.- See Also:
-
LIGHT_INDEX_MAX
public static final int LIGHT_INDEX_MAXMax number of light.- See Also:
-
ambientRadio
Radio button for different light type. -
bNeedsRedraw
private boolean bNeedsRedrawFlag is set if one of the controls changed a value and the renderering needs to be redrawn when the mouse is released. -
checkBoxShowLight
Check box to show the light bulb or not. -
colorButton
Color button, checkBox On/Off. -
colorChooser
Color choose dialog reference. -
colorLabel
Color label. -
controlPanel
Control panel. -
controlPanelBox
Control panel box that hold the control panel. -
directionalRadio
Directional light radio botton. -
drawPanel
Scroll panel reference. -
intensitySlider
Intensity slider. -
iSelect
private int iSelectindex of currently selected one. -
labelIntensity
Light intensity label. -
labelIntensityBegin
Light intensity label begin. -
labelIntensityEnd
Light intensity label end. -
labelIntensityMid
Light intensity label middle. -
labelShininess
Light shinness label. -
labelShininessBegin
Shinness label begin. -
labelShininessEnd
Shinness label end. -
labelShininessMid
Shinness lable middle. -
list
List of lights. -
m_aiLightScale
private int[] m_aiLightScaleLight scale factor array. -
m_akLights
The structure for the light bulbs. -
m_akModelLights
General light array. -
m_akSoftwareLightsModel
Soft light array. -
m_akSoftwareLightsWorld
Lighting objects needed for software rendering. -
m_akWorldLights
World general light array. -
m_kLabelPosX
Label for slider X position. -
m_kLabelPosY
Label for slider Y position. -
m_kLabelPosZ
Label for slider Z position. -
m_kLabelTrgX
Label for X light target position. -
m_kLabelTrgY
Label for Y light target position. -
m_kLabelTrgZ
Label for Z light target position. -
m_kPanelSurface
surface panel reference. -
m_kRenderSurface
Parent render frame reference. -
m_kSliderPosX
Light x position slider. -
m_kSliderPosY
Light y position slider. -
m_kSliderPosZ
Light z position slider. -
m_kSliderTrgX
Light x target position slider. -
m_kSliderTrgY
Light y target position slider. -
m_kSliderTrgZ
Light z target position slider. -
m_kTextPosX
X position text field. -
m_kTextPosY
Y position text field. -
m_kTextPosZ
Z position text field. -
m_kTextTrgX
X target position text field. -
m_kTextTrgY
Y target position text field. -
m_kTextTrgZ
Z target position text field. -
onOffCheckBox
Light turn on/off check box. -
onOffLabel
Light turn on/off label. -
pointRadio
Point light radio button. -
scroller
Scroll pane. -
scrollPanel
Scroll the control panel when the frame changes size. -
shininessPanel
Shininess panel. -
shininessSlider
Shininess slider. -
spotRadio
Spot light radio button. -
textIntensity
Light intensity textfield. -
textShininess
Light shinness textfield. -
xBox
private float xBoxx, y, z box size. -
yBox
private float yBoxx, y, z box size. -
zBox
private float zBoxx, y, z box size. -
maxBox
private float maxBoxx, y, z box size. -
m_kGPUVolumeRender
-
-
Constructor Details
-
JPanelLights
Constructor.- Parameters:
kPanelSurface- JPanelSurface Reference to the panel which contains the surface view. This may be a null reference to indicate that there is no corresponding surface view panel.kRenderSurface- SurfaceRender Reference to view which contains the surface rendered view.
-
-
Method Details
-
actionPerformed
Changes color of slices box frame and button if color button was pressed; turns bounding box on and off if checkbox was pressed; and closes dialog if "Close" button was pressed.- Specified by:
actionPerformedin interfaceActionListener- Specified by:
actionPerformedin classJPanelRendererBase- Parameters:
event- Event that triggered function.
-
disposeLocal
public void disposeLocal(boolean flag) Clear memory and garbage collection.- Parameters:
flag- call super dispose or not
-
getGeneralLight
The the general light with the given index.- Parameters:
iIndex- light index- Returns:
- GeneralLight general light model.
-
getGeneralLights
Returns all general lights.- Returns:
- GeneralLight[] general light model.
-
getMainPanel
Get the main control Panel.- Specified by:
getMainPanelin classJPanelRendererBase- Returns:
- mainPanel main control panel
-
getNumLights
public int getNumLights()Get the number of lights.- Returns:
- int max light number
-
getSoftwareLightsModel
Get the software light model.- Returns:
- SoftwareLight[] array of the software light.
-
getSoftwareLightsWorld
Get the software light world.- Returns:
- SoftwareLight[] array of the software light world.
-
mouseClicked
Unchanged.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseEntered
Unchanged.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseExited
Unchanged.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mousePressed
Unchanged.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
mouseReleased
Used in MouseRecorder to stop one series of slide moves.- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
event- Original mouse event.
-
refreshLighting
public void refreshLighting()Repaints the parent frame with the correct lighting. -
resizePanel
public void resizePanel(int panelWidth, int frameHeight) Resizig the control panel with ViewJFrameVolumeView's frame width and height.- Overrides:
resizePanelin classJPanelRendererBase- Parameters:
panelWidth- widthframeHeight- height
-
setSelectedIndex
public void setSelectedIndex(int index) Sets the light to selected.- Parameters:
index- Index of light
-
stateChanged
Slider move event handler.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
e- Slider move events
-
updateSoftwareLights
public void updateSoftwareLights()Get the current SoftwareLight instances from each of the GeneralLight instances -- for the world- and model-based lights. -
valueChanged
Sets values of sliders and intensities appropriately based on which light was chosen in the list.- Specified by:
valueChangedin interfaceListSelectionListener- Parameters:
kEvent- Event that triggered this function.
-
finalize
Calls dispose.- Overrides:
finalizein classJPanelRendererBase- Throws:
Throwable- throw exception.
-
addControlPanel
private void addControlPanel(JPanel panelControl, Component c, GridBagConstraints gbc, int x, int y, int w, int h) Helper method that adds components to the control panel for the grid bag layout.- Parameters:
panelControl- control panel reference.c- Component added to the control panel.gbc- GridBagConstraints of added component.x- Gridx locationy- Gridy locationw- Gridwidthh- Gridheight
-
buildControlPanel
private void buildControlPanel()Build the light control panel. -
buildListPanel
private void buildListPanel()Build the light list panel. -
buildShininessPanel
private void buildShininessPanel()Build the shinness control panel. -
createLabel
Creates a label in the proper font and color.- Parameters:
title- The title of the label.bEnable- True if label is to be enabled.- Returns:
- The new label.
-
refreshControlPanel
public void refreshControlPanel()Refresh the light control panel. -
enableLight
public void enableLight(int iSelect, boolean bOn)
-