Class 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:
  • Field Details

    • serialVersionUID

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

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

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

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

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

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

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

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

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

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

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

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

      private 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 JCheckBox checkBoxShowLight
      Check box to show the light bulb or not.
    • colorButton

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

      private ViewJColorChooser colorChooser
      Color choose dialog reference.
    • colorLabel

      private JLabel colorLabel
      Color label.
    • controlPanel

      private JPanel controlPanel
      Control panel.
    • controlPanelBox

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

      private JRadioButton directionalRadio
      Directional light radio botton.
    • drawPanel

      private JPanel drawPanel
      Scroll panel reference.
    • intensitySlider

      private JSlider intensitySlider
      Intensity slider.
    • iSelect

      private int iSelect
      index of currently selected one.
    • labelIntensity

      private JLabel labelIntensity
      Light intensity label.
    • labelIntensityBegin

      private JLabel labelIntensityBegin
      Light intensity label begin.
    • labelIntensityEnd

      private JLabel labelIntensityEnd
      Light intensity label end.
    • labelIntensityMid

      private JLabel labelIntensityMid
      Light intensity label middle.
    • labelShininess

      private JLabel labelShininess
      Light shinness label.
    • labelShininessBegin

      private JLabel labelShininessBegin
      Shinness label begin.
    • labelShininessEnd

      private JLabel labelShininessEnd
      Shinness label end.
    • labelShininessMid

      private JLabel labelShininessMid
      Shinness lable middle.
    • list

      private 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 JLabel m_kLabelPosX
      Label for slider X position.
    • m_kLabelPosY

      private JLabel m_kLabelPosY
      Label for slider Y position.
    • m_kLabelPosZ

      private JLabel m_kLabelPosZ
      Label for slider Z position.
    • m_kLabelTrgX

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

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

      private 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 JSlider m_kSliderPosX
      Light x position slider.
    • m_kSliderPosY

      private JSlider m_kSliderPosY
      Light y position slider.
    • m_kSliderPosZ

      private JSlider m_kSliderPosZ
      Light z position slider.
    • m_kSliderTrgX

      private JSlider m_kSliderTrgX
      Light x target position slider.
    • m_kSliderTrgY

      private JSlider m_kSliderTrgY
      Light y target position slider.
    • m_kSliderTrgZ

      private JSlider m_kSliderTrgZ
      Light z target position slider.
    • m_kTextPosX

      private JTextField m_kTextPosX
      X position text field.
    • m_kTextPosY

      private JTextField m_kTextPosY
      Y position text field.
    • m_kTextPosZ

      private JTextField m_kTextPosZ
      Z position text field.
    • m_kTextTrgX

      private JTextField m_kTextTrgX
      X target position text field.
    • m_kTextTrgY

      private JTextField m_kTextTrgY
      Y target position text field.
    • m_kTextTrgZ

      private JTextField m_kTextTrgZ
      Z target position text field.
    • onOffCheckBox

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

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

      private JRadioButton pointRadio
      Point light radio button.
    • scroller

      private JScrollPane scroller
      Scroll pane.
    • scrollPanel

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

      private JPanel shininessPanel
      Shininess panel.
    • shininessSlider

      private JSlider shininessSlider
      Shininess slider.
    • spotRadio

      private JRadioButton spotRadio
      Spot light radio button.
    • textIntensity

      private JTextField textIntensity
      Light intensity textfield.
    • textShininess

      private 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.
    • m_kGPUVolumeRender

      private VolumeTriPlanarRender m_kGPUVolumeRender
  • Constructor Details

    • 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 Details

    • actionPerformed

      public void actionPerformed(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 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 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(MouseEvent event)
      Unchanged.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - Original mouse event.
    • mouseEntered

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

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

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

      public void mouseReleased(MouseEvent event)
      Used in MouseRecorder to stop one series of slide moves.
      Specified by:
      mouseReleased in interface 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(ChangeEvent e)
      Slider move event handler.
      Specified by:
      stateChanged in interface 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(ListSelectionEvent kEvent)
      Sets values of sliders and intensities appropriately based on which light was chosen in the list.
      Specified by:
      valueChanged in interface ListSelectionListener
      Parameters:
      kEvent - Event that triggered this function.
    • finalize

      protected void finalize() throws Throwable
      Calls dispose.
      Overrides:
      finalize in class JPanelRendererBase
      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 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 JLabel createLabel(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)