Class JPanelLights_WM
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
gov.nih.mipav.view.renderer.WildMagic.Interface.JInterfaceBase
gov.nih.mipav.view.renderer.WildMagic.Interface.JPanelLights_WM
- All Implemented Interfaces:
ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,ListSelectionListener,RootPaneContainer,WindowConstants
public class JPanelLights_WM
extends JInterfaceBase
implements ChangeListener, 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 classes/interfaces inherited from class gov.nih.mipav.view.renderer.WildMagic.Interface.JInterfaceBase
JInterfaceBase.CancelListener, JInterfaceBase.DrawingPanel, JInterfaceBase.OkColorListenerNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested 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 JButtonColor button, checkBox On/Off.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.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 WildMagic.LibGraphics.Rendering.Light[]The structure for the light bulbs.private 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 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 JRadioButtonSpot light radio button.private JTextFieldLight intensity 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.WildMagic.Interface.JInterfaceBase
cancelButton, colorChooser, m_kVolumeViewer, mainPanel, OKButton, rayBasedRenderWMFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionJPanelLights_WM(VolumeTriPlanarInterface kVolumeViewer) Constructor.JPanelLights_WM(VolumeTriPlanarRender rayBasedRenderWM) -
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.WildMagic.LibGraphics.Rendering.Light[]private JLabelcreateLabel(String title, boolean bEnable) Creates a label in the proper font and color.voidClear memory and garbage collection.voidenableLight(int iSelect, boolean bOn) Enable the selected light.protected voidfinalize()WildMagic.LibGraphics.Rendering.Light[]Returns all general lights.WildMagic.LibGraphics.Rendering.LightgetLight(int iIndex) The the general light with the given index.intGet the number of lights.intprivate voidinit(ModelImage image) makeString(float number, int decPts) Makes a string of a floating point number with a specific number of decimal points.voidRefresh the light control panel.voidRepaints the parent frame with the correct lighting.voidresizePanel(int panelWidth, int frameHeight) Resizing the control panel with ViewJFrameVolumeView's frame width and height.voidsetAllLights(WildMagic.LibGraphics.Rendering.Light[] akLights) voidsetButtonColor(JButton _button, Color _color) Set the color of the button.voidsetSelectedIndex(int index) Sets the light to selected.voidSlider move event handler.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.WildMagic.Interface.JInterfaceBase
buildCancelButton, buildOKButton, buildTitledBorder, getMainPanel, updateColorButtonMethods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
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:
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
ambientRadio
Radio button for different light type. -
colorButton
Color button, checkBox On/Off. -
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. -
list
List of lights. -
m_aiLightScale
private int[] m_aiLightScaleLight scale factor array. -
m_akLights
private WildMagic.LibGraphics.Rendering.Light[] m_akLightsThe structure for the light bulbs. -
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_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. -
spotRadio
Spot light radio button. -
textIntensity
Light intensity 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.
-
-
Constructor Details
-
JPanelLights_WM
-
JPanelLights_WM
Constructor.- Parameters:
kVolumeViewer- parent frame.
-
-
Method Details
-
init
-
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- Parameters:
event- Event that triggered function.
-
disposeLocal
public void disposeLocal()Clear memory and garbage collection. -
enableLight
public void enableLight(int iSelect, boolean bOn) Enable the selected light.- Parameters:
iSelect- the light to enable.bOn- turns light on/off.
-
getAllLights
public WildMagic.LibGraphics.Rendering.Light[] getAllLights()Returns all general lights.- Returns:
- GeneralLight[] general light model.
-
copyAllLights
public WildMagic.LibGraphics.Rendering.Light[] copyAllLights() -
setAllLights
public void setAllLights(WildMagic.LibGraphics.Rendering.Light[] akLights) -
getSelected
public int getSelected() -
getLight
public WildMagic.LibGraphics.Rendering.Light getLight(int iIndex) The the general light with the given index.- Parameters:
iIndex- light index- Returns:
- GeneralLight general light model.
-
getNumLights
public int getNumLights()Get the number of lights.- Returns:
- int max light number
-
makeString
Makes a string of a floating point number with a specific number of decimal points.- Parameters:
number- Number to be converted to a string.decPts- The number of decimal points.- Returns:
- String representation of the number.
-
refreshControlPanel
public void refreshControlPanel()Refresh the light control panel. -
refreshLighting
public void refreshLighting()Repaints the parent frame with the correct lighting. -
resizePanel
public void resizePanel(int panelWidth, int frameHeight) Resizing the control panel with ViewJFrameVolumeView's frame width and height.- Parameters:
panelWidth- widthframeHeight- height
-
setButtonColor
Description copied from class:JInterfaceBaseSet the color of the button. Derived classes may also perform other functions.- Overrides:
setButtonColorin classJInterfaceBase- Parameters:
_button- button._color- color.
-
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
-
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
-
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. -
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.
-