Class JFrameSurfaceMaterialProperties_WM
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
gov.nih.mipav.view.renderer.WildMagic.Interface.JFrameSurfaceMaterialProperties_WM
- All Implemented Interfaces:
ActionListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener,RootPaneContainer,WindowConstants
public class JFrameSurfaceMaterialProperties_WM
extends JFrame
implements WindowListener, ActionListener, ChangeListener
Window for setting the surface material properties. The window displays two sample spheres: a "before" and "after"
sphere. Both are initialized to the current material properties and transparency of the surface. The user can change
the ambient, diffuse, specular, and emmissive colors with a color control dialog. The user can also change the
specular coefficient, or "shininess" through a slider interface.
Pressing the "apply" button the user can see the changes applied to sthe surface. Pressing the "reset" button resets the surface and material properties interface to the original surface parameters. Pressing "OK" applies the changes to the surface and closes the window, Pressing "cancel" resets the changes and closes the window.
- Author:
- Alexandra Bokinsky
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested 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 intBefore/After index values for the two displayed spheres, canvases, and display panels:.static intprivate intBefore/After index values for the two displayed spheres, canvases, and display panels:.static intstatic intprivate WildMagic.LibGraphics.Rendering.MaterialState[]Pre-defined materialsprivate SurfaceMaterialDisplay[]private booleankeeps track of whether or not color has been applied to surface (for backup on cancel)private floatspecular coefficientprivate intPreset Material's examples:.private intthe index of the surface that is being changed in the JPanelSurfaceprivate intWhich button is pressed to activate the JColorChooser:.private WildMagic.LibFoundation.Mathematics.ColorRGBCurrent color values:.private JButtonMaterial Properties color buttons:.private com.jogamp.opengl.util.Animatorprivate JColorChooserColor Chooser dialog:.private WildMagic.LibFoundation.Mathematics.ColorRGBdiffuse colorprivate JButtondiffuse color buttonprivate WildMagic.LibFoundation.Mathematics.ColorRGBemissive colorprivate JButtonemissive color buttonprivate JSplitPaneSplit pane for displaying the canvases side-by-side:.private JPanel[]Canvas display panels:.private JSplitPaneSplit pane for displaying the rendered spheres above the interface:.private WildMagic.LibGraphics.Rendering.MaterialStateMaterials for new vales and backup:.private JPanelWindow display panels: Material properties buttons/slider panel:.private WildMagic.LibGraphics.Rendering.MaterialStateSaved Material for backupprivate JPanelSurface_WMParent class:.private JSliderShininess slider.private WildMagic.LibFoundation.Mathematics.ColorRGBSpecular color componentprivate JButtonSpecular color buttonprivate static final longUse serialVersionUID for interoperability.static intFields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORFields 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
ConstructorsConstructorDescriptionJFrameSurfaceMaterialProperties_WM(JPanelSurface_WM kParent, int iSurface, WildMagic.LibGraphics.Rendering.Light[] akGeneralLights, WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Creates the Surface Material Editor window. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent kEvent) Called when a button is pressed:private voidUpdate the color changes to the Before sphere and the original surface.private JPanelBuilds the preset panel to display the preset images and buttons.voiddispose()Deletes all local data members.private voidUp to 6 preset materials can be defined.private voidReset the color changes for the Before sphere and the original surface, based on the original surface material properties, also update the user-interface buttons to the original values.private voidSets up the user interface.private voidsetupMaterials(WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Reads the current color values from the Material and sets the values for the two spheres displayed in the interface.private voidsetupScene(WildMagic.LibGraphics.Rendering.Light[] akGeneralLights) Sets up the rendered scenes.voidstateChanged(ChangeEvent event) Called when the slider values have changed.voidvoidvoidwindowClosing Catch the windowClosing event so that the local data memebrs can be destroyed.voidvoidvoidvoidStarts Animator on windowOpened.Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, 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, 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
AMBIENT
public static int AMBIENT -
DIFFUSE
public static int DIFFUSE -
EMISSIVE
public static int EMISSIVE -
SPECULAR
public static int SPECULAR -
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
AFTER
private int AFTERBefore/After index values for the two displayed spheres, canvases, and display panels:. -
BEFORE
private int BEFOREBefore/After index values for the two displayed spheres, canvases, and display panels:. -
m_akMaterialPreset
private WildMagic.LibGraphics.Rendering.MaterialState[] m_akMaterialPresetPre-defined materials -
m_fShininess
private float m_fShininessspecular coefficient -
m_iNumPreset
private int m_iNumPresetPreset Material's examples:. -
m_iSurfaceIndex
private int m_iSurfaceIndexthe index of the surface that is being changed in the JPanelSurface -
m_iWhichButton
private int m_iWhichButtonWhich button is pressed to activate the JColorChooser:. -
m_kAmbient
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kAmbientCurrent color values:. -
m_kAmbientColorButton
Material Properties color buttons:. -
m_kColorChooser
Color Chooser dialog:. -
m_kDiffuse
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kDiffusediffuse color -
m_kDiffuseColorButton
diffuse color button -
m_kEmissive
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kEmissiveemissive color -
m_kEmissiveColorButton
emissive color button -
m_kImagePane
Split pane for displaying the canvases side-by-side:. -
m_kImagePanel
Canvas display panels:. -
m_kMainPane
Split pane for displaying the rendered spheres above the interface:. -
m_kMaterialNew
private WildMagic.LibGraphics.Rendering.MaterialState m_kMaterialNewMaterials for new vales and backup:. -
m_kMaterialPanel
Window display panels: Material properties buttons/slider panel:. -
m_kMaterialSave
private WildMagic.LibGraphics.Rendering.MaterialState m_kMaterialSaveSaved Material for backup -
m_kParent
Parent class:. -
m_kShininessSlider
Shininess slider. -
m_kSpecular
private WildMagic.LibFoundation.Mathematics.ColorRGB m_kSpecularSpecular color component -
m_kSpecularColorButton
Specular color button -
m_bColorApplied
private boolean m_bColorAppliedkeeps track of whether or not color has been applied to surface (for backup on cancel) -
m_akSurfaceMaterial
-
m_kAnimator
private com.jogamp.opengl.util.Animator m_kAnimator
-
-
Constructor Details
-
JFrameSurfaceMaterialProperties_WM
public JFrameSurfaceMaterialProperties_WM(JPanelSurface_WM kParent, int iSurface, WildMagic.LibGraphics.Rendering.Light[] akGeneralLights, WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Creates the Surface Material Editor window. The two example spheres are displayed with the same lights, opacity, and material properties as the surface.- Parameters:
kParent- the array of lights that are used to light the surfaceiSurface- the opacity of the surfaceakGeneralLights- DOCUMENT ME!kMaterial- the original material properties.fOpacity- DOCUMENT ME!
-
-
Method Details
-
actionPerformed
Called when a button is pressed:- Specified by:
actionPerformedin interfaceActionListener- Parameters:
kEvent- action event
-
dispose
public void dispose()Deletes all local data members. -
stateChanged
Called when the slider values have changed. Reads the new shininess values and sets the Material Properties.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
event- ChangeEvent state change event.
-
windowActivated
- Specified by:
windowActivatedin interfaceWindowListener
-
windowClosed
- Specified by:
windowClosedin interfaceWindowListener
-
windowClosing
windowClosing Catch the windowClosing event so that the local data memebrs can be destroyed.- Specified by:
windowClosingin interfaceWindowListener- Parameters:
e- WindowEvent
-
windowDeactivated
- Specified by:
windowDeactivatedin interfaceWindowListener
-
windowDeiconified
- Specified by:
windowDeiconifiedin interfaceWindowListener
-
windowIconified
- Specified by:
windowIconifiedin interfaceWindowListener
-
windowOpened
Starts Animator on windowOpened.- Specified by:
windowOpenedin interfaceWindowListener- Parameters:
e- WindowEvent
-
applyColorChange
private void applyColorChange()Update the color changes to the Before sphere and the original surface. -
buildPresetPanel
Builds the preset panel to display the preset images and buttons.- Returns:
- the preset panel to display the preset images and buttons.
-
initMaterialPreset
private void initMaterialPreset()Up to 6 preset materials can be defined. -
resetColorChange
private void resetColorChange()Reset the color changes for the Before sphere and the original surface, based on the original surface material properties, also update the user-interface buttons to the original values. -
setupInterface
private void setupInterface()Sets up the user interface. Button and slider. -
setupMaterials
private void setupMaterials(WildMagic.LibGraphics.Rendering.MaterialState kMaterial) Reads the current color values from the Material and sets the values for the two spheres displayed in the interface. Saves the original values in case the Reset button is pressed.- Parameters:
kMaterial- material reference.
-
setupScene
private void setupScene(WildMagic.LibGraphics.Rendering.Light[] akGeneralLights) Sets up the rendered scenes. Two spheres, each displayed in a separate canvas window with the same lighting, material, and transparency parameters as the original surface. The "Before" sphere only changes when the "Apply" button is pressed, the "After" sphere changes each time one of the color buttons or the shininess slider is changed- Parameters:
akGeneralLights- GeneralLight[] light array
-