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

    • 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:
    • serialVersionUID

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

      private JRadioButton ambientRadio
      Radio button for different light type.
    • colorButton

      private JButton colorButton
      Color button, checkBox On/Off.
    • 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.
    • list

      private JList list
      List of lights.
    • m_aiLightScale

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

      private WildMagic.LibGraphics.Rendering.Light[] m_akLights
      The structure for the light bulbs.
    • 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_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.
    • spotRadio

      private JRadioButton spotRadio
      Spot light radio button.
    • textIntensity

      private JTextField textIntensity
      Light intensity 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 Details

  • Method Details

    • init

      private void init(ModelImage image)
    • 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
      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

      public String makeString(float number, int decPts)
      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 - width
      frameHeight - height
    • setButtonColor

      public void setButtonColor(JButton _button, Color _color)
      Description copied from class: JInterfaceBase
      Set the color of the button. Derived classes may also perform other functions.
      Overrides:
      setButtonColor in class JInterfaceBase
      Parameters:
      _button - button.
      _color - color.
    • 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
    • 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
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • 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.
    • 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.