Class JPanelLights

  • 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, javax.swing.event.ListSelectionListener

    public class JPanelLights
    extends JPanelRendererJ3D
    implements javax.swing.event.ChangeListener, java.awt.event.MouseListener, javax.swing.event.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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  JPanelLights.CancelListener
      Cancel the color dialog, change nothing.
      (package private) class  JPanelLights.OkColorListener
      Pick up the selected color and call method to change the surface color.
      • 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
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.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 void addControlPanel​(javax.swing.JPanel panelControl, java.awt.Component c, java.awt.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 void buildControlPanel()
      Build the light control panel.
      private void buildListPanel()
      Build the light list panel.
      private void buildShininessPanel()
      Build the shinness control panel.
      private javax.swing.JLabel createLabel​(java.lang.String title, boolean bEnable)
      Creates a label in the proper font and color.
      void disposeLocal​(boolean flag)
      Clear memory and garbage collection.
      void enableLight​(int iSelect, boolean bOn)  
      protected void finalize()
      Calls dispose.
      GeneralLight getGeneralLight​(int iIndex)
      The the general light with the given index.
      GeneralLight[] getGeneralLights()
      Returns all general lights.
      javax.swing.JPanel getMainPanel()
      Get the main control Panel.
      int getNumLights()
      Get the number of lights.
      SoftwareLight[] getSoftwareLightsModel()
      Get the software light model.
      SoftwareLight[] getSoftwareLightsWorld()
      Get the software light world.
      void mouseClicked​(java.awt.event.MouseEvent event)
      Unchanged.
      void mouseEntered​(java.awt.event.MouseEvent event)
      Unchanged.
      void mouseExited​(java.awt.event.MouseEvent event)
      Unchanged.
      void mousePressed​(java.awt.event.MouseEvent event)
      Unchanged.
      void mouseReleased​(java.awt.event.MouseEvent event)
      Used in MouseRecorder to stop one series of slide moves.
      void refreshControlPanel()
      Refresh the light control panel.
      void refreshLighting()
      Repaints the parent frame with the correct lighting.
      void resizePanel​(int panelWidth, int frameHeight)
      Resizig the control panel with ViewJFrameVolumeView's frame width and height.
      void setSelectedIndex​(int index)
      Sets the light to selected.
      void stateChanged​(javax.swing.event.ChangeEvent e)
      Slider move event handler.
      void updateSoftwareLights()
      Get the current SoftwareLight instances from each of the GeneralLight instances -- for the world- and model-based lights.
      void valueChanged​(javax.swing.event.ListSelectionEvent kEvent)
      Sets values of sliders and intensities appropriately based on which light was chosen in the list.
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.event.FocusListener

        focusGained, focusLost
      • Methods inherited from interface java.awt.event.ItemListener

        itemStateChanged
      • Methods inherited from interface java.awt.event.KeyListener

        keyPressed, keyReleased, keyTyped
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_STATIC

        public static final int LIGHT_INDEX_STATIC
        Static light index.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_AMBIENT

        public static final int LIGHT_INDEX_AMBIENT
        Ambient light index.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X0Y0Z0

        public static final int LIGHT_INDEX_MODEL_X0Y0Z0
        light for corner X0Y0Z0.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X1Y0Z0

        public static final int LIGHT_INDEX_MODEL_X1Y0Z0
        light for corner X1Y0Z0.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X0Y1Z0

        public static final int LIGHT_INDEX_MODEL_X0Y1Z0
        light for corner X0Y1Z0.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X1Y1Z0

        public static final int LIGHT_INDEX_MODEL_X1Y1Z0
        light for corner X1Y1Z0.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X0Y0Z1

        public static final int LIGHT_INDEX_MODEL_X0Y0Z1
        light for corner X0Y0Z1.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X1Y0Z1

        public static final int LIGHT_INDEX_MODEL_X1Y0Z1
        light for corner X1Y0Z1.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X0Y1Z1

        public static final int LIGHT_INDEX_MODEL_X0Y1Z1
        light for corner X0Y1Z1.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MODEL_X1Y1Z1

        public static final int LIGHT_INDEX_MODEL_X1Y1Z1
        light for corner X1Y1Z1.
        See Also:
        Constant Field Values
      • LIGHT_INDEX_MAX

        public static final int LIGHT_INDEX_MAX
        Max number of light.
        See Also:
        Constant Field Values
      • ambientRadio

        private javax.swing.JRadioButton ambientRadio
        Radio button for different light type.
      • bNeedsRedraw

        private boolean bNeedsRedraw
        Flag is set if one of the controls changed a value and the renderering needs to be redrawn when the mouse is released.
      • checkBoxShowLight

        private javax.swing.JCheckBox checkBoxShowLight
        Check box to show the light bulb or not.
      • colorButton

        private javax.swing.JButton colorButton
        Color button, checkBox On/Off.
      • colorChooser

        private ViewJColorChooser colorChooser
        Color choose dialog reference.
      • colorLabel

        private javax.swing.JLabel colorLabel
        Color label.
      • controlPanel

        private javax.swing.JPanel controlPanel
        Control panel.
      • controlPanelBox

        private javax.swing.Box controlPanelBox
        Control panel box that hold the control panel.
      • directionalRadio

        private javax.swing.JRadioButton directionalRadio
        Directional light radio botton.
      • drawPanel

        private javax.swing.JPanel drawPanel
        Scroll panel reference.
      • intensitySlider

        private javax.swing.JSlider intensitySlider
        Intensity slider.
      • iSelect

        private int iSelect
        index of currently selected one.
      • labelIntensity

        private javax.swing.JLabel labelIntensity
        Light intensity label.
      • labelIntensityBegin

        private javax.swing.JLabel labelIntensityBegin
        Light intensity label begin.
      • labelIntensityEnd

        private javax.swing.JLabel labelIntensityEnd
        Light intensity label end.
      • labelIntensityMid

        private javax.swing.JLabel labelIntensityMid
        Light intensity label middle.
      • labelShininess

        private javax.swing.JLabel labelShininess
        Light shinness label.
      • labelShininessBegin

        private javax.swing.JLabel labelShininessBegin
        Shinness label begin.
      • labelShininessEnd

        private javax.swing.JLabel labelShininessEnd
        Shinness label end.
      • labelShininessMid

        private javax.swing.JLabel labelShininessMid
        Shinness lable middle.
      • list

        private javax.swing.JList list
        List of lights.
      • m_aiLightScale

        private int[] m_aiLightScale
        Light scale factor array.
      • m_akLights

        private GeneralLight[] m_akLights
        The structure for the light bulbs.
      • m_akModelLights

        private GeneralLight[] m_akModelLights
        General light array.
      • m_akSoftwareLightsModel

        private SoftwareLight[] m_akSoftwareLightsModel
        Soft light array.
      • m_akSoftwareLightsWorld

        private SoftwareLight[] m_akSoftwareLightsWorld
        Lighting objects needed for software rendering.
      • m_akWorldLights

        private GeneralLight[] m_akWorldLights
        World general light array.
      • m_kLabelPosX

        private javax.swing.JLabel m_kLabelPosX
        Label for slider X position.
      • m_kLabelPosY

        private javax.swing.JLabel m_kLabelPosY
        Label for slider Y position.
      • m_kLabelPosZ

        private javax.swing.JLabel m_kLabelPosZ
        Label for slider Z position.
      • m_kLabelTrgX

        private javax.swing.JLabel m_kLabelTrgX
        Label for X light target position.
      • m_kLabelTrgY

        private javax.swing.JLabel m_kLabelTrgY
        Label for Y light target position.
      • m_kLabelTrgZ

        private javax.swing.JLabel m_kLabelTrgZ
        Label for Z light target position.
      • m_kPanelSurface

        private JPanelSurface m_kPanelSurface
        surface panel reference.
      • m_kRenderSurface

        private SurfaceRender m_kRenderSurface
        Parent render frame reference.
      • m_kSliderPosX

        private javax.swing.JSlider m_kSliderPosX
        Light x position slider.
      • m_kSliderPosY

        private javax.swing.JSlider m_kSliderPosY
        Light y position slider.
      • m_kSliderPosZ

        private javax.swing.JSlider m_kSliderPosZ
        Light z position slider.
      • m_kSliderTrgX

        private javax.swing.JSlider m_kSliderTrgX
        Light x target position slider.
      • m_kSliderTrgY

        private javax.swing.JSlider m_kSliderTrgY
        Light y target position slider.
      • m_kSliderTrgZ

        private javax.swing.JSlider m_kSliderTrgZ
        Light z target position slider.
      • m_kTextPosX

        private javax.swing.JTextField m_kTextPosX
        X position text field.
      • m_kTextPosY

        private javax.swing.JTextField m_kTextPosY
        Y position text field.
      • m_kTextPosZ

        private javax.swing.JTextField m_kTextPosZ
        Z position text field.
      • m_kTextTrgX

        private javax.swing.JTextField m_kTextTrgX
        X target position text field.
      • m_kTextTrgY

        private javax.swing.JTextField m_kTextTrgY
        Y target position text field.
      • m_kTextTrgZ

        private javax.swing.JTextField m_kTextTrgZ
        Z target position text field.
      • onOffCheckBox

        private javax.swing.JCheckBox onOffCheckBox
        Light turn on/off check box.
      • onOffLabel

        private javax.swing.JLabel onOffLabel
        Light turn on/off label.
      • pointRadio

        private javax.swing.JRadioButton pointRadio
        Point light radio button.
      • scroller

        private javax.swing.JScrollPane scroller
        Scroll pane.
      • scrollPanel

        private javax.swing.JPanel scrollPanel
        Scroll the control panel when the frame changes size.
      • shininessPanel

        private javax.swing.JPanel shininessPanel
        Shininess panel.
      • shininessSlider

        private javax.swing.JSlider shininessSlider
        Shininess slider.
      • spotRadio

        private javax.swing.JRadioButton spotRadio
        Spot light radio button.
      • textIntensity

        private javax.swing.JTextField textIntensity
        Light intensity textfield.
      • textShininess

        private javax.swing.JTextField textShininess
        Light shinness textfield.
      • xBox

        private float xBox
        x, y, z box size.
      • yBox

        private float yBox
        x, y, z box size.
      • zBox

        private float zBox
        x, y, z box size.
      • maxBox

        private float maxBox
        x, y, z box size.
    • Constructor Detail

      • JPanelLights

        public JPanelLights​(JPanelSurface kPanelSurface,
                            SurfaceRender kRenderSurface)
        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 Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.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.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Specified by:
        actionPerformed in class JPanelRendererBase
        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

        public GeneralLight getGeneralLight​(int iIndex)
        The the general light with the given index.
        Parameters:
        iIndex - light index
        Returns:
        GeneralLight general light model.
      • getGeneralLights

        public GeneralLight[] getGeneralLights()
        Returns all general lights.
        Returns:
        GeneralLight[] general light model.
      • getMainPanel

        public javax.swing.JPanel getMainPanel()
        Get the main control Panel.
        Specified by:
        getMainPanel in class JPanelRendererBase
        Returns:
        mainPanel main control panel
      • getNumLights

        public int getNumLights()
        Get the number of lights.
        Returns:
        int max light number
      • getSoftwareLightsModel

        public SoftwareLight[] getSoftwareLightsModel()
        Get the software light model.
        Returns:
        SoftwareLight[] array of the software light.
      • getSoftwareLightsWorld

        public SoftwareLight[] getSoftwareLightsWorld()
        Get the software light world.
        Returns:
        SoftwareLight[] array of the software light world.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent event)
        Unchanged.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        event - Original mouse event.
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent event)
        Unchanged.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        event - Original mouse event.
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent event)
        Unchanged.
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        event - Original mouse event.
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent event)
        Unchanged.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        event - Original mouse event.
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent event)
        Used in MouseRecorder to stop one series of slide moves.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        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:
        resizePanel in class JPanelRendererBase
        Parameters:
        panelWidth - width
        frameHeight - height
      • setSelectedIndex

        public void setSelectedIndex​(int index)
        Sets the light to selected.
        Parameters:
        index - Index of light
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent e)
        Slider move event handler.
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
        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

        public void valueChanged​(javax.swing.event.ListSelectionEvent kEvent)
        Sets values of sliders and intensities appropriately based on which light was chosen in the list.
        Specified by:
        valueChanged in interface javax.swing.event.ListSelectionListener
        Parameters:
        kEvent - Event that triggered this function.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Calls dispose.
        Overrides:
        finalize in class JPanelRendererBase
        Throws:
        java.lang.Throwable - throw exception.
      • addControlPanel

        private void addControlPanel​(javax.swing.JPanel panelControl,
                                     java.awt.Component c,
                                     java.awt.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 location
        y - Gridy location
        w - Gridwidth
        h - 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

        private javax.swing.JLabel createLabel​(java.lang.String title,
                                               boolean bEnable)
        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)