Class JDialogBrightness

All Implemented Interfaces:
DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants

public class JDialogBrightness extends JDialogBase implements ChangeListener
This class creates a simple dialog in which the user can specify a brightness integer and a contrast float using sliders. Called from ViewJFrameAnimate.
Version:
April 24, 2002
Author:
Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

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

      private int brightness
      DOCUMENT ME!
    • brightnessSlider

      private JSlider brightnessSlider
      DOCUMENT ME!
    • contrastSlider

      private JSlider contrastSlider
      DOCUMENT ME!
    • componentImage

      private ViewJComponentAnimate componentImage
      DOCUMENT ME!
    • componentImageColEM

      private ViewJComponentColocalizationEM componentImageColEM
      DOCUMENT ME!
    • componentImageColReg

      private ViewJComponentColocalizationRegression componentImageColReg
      DOCUMENT ME!
    • contrast

      private float contrast
      DOCUMENT ME!
    • current

      private JLabel current
      DOCUMENT ME!
    • current2

      private JLabel current2
      DOCUMENT ME!
    • nfc

      private NumberFormat nfc
      DOCUMENT ME!
  • Constructor Details

    • JDialogBrightness

      public JDialogBrightness(JFrame parent, ViewJComponentAnimate compImage, int bright, float con)
      Creates new dialog for entering brightness and contrast.
      Parameters:
      parent - Parent frame.
      compImage - Component image to change.
      bright - Initial brightness.
      con - Initial contrast.
    • JDialogBrightness

      public JDialogBrightness(JFrame parent, ViewJComponentColocalizationRegression compImage, int bright, float con)
      Creates new dialog for entering brightness and contrast.
      Parameters:
      parent - Parent frame.
      compImage - Component image to change.
      bright - Initial brightness.
      con - Initial contrast.
    • JDialogBrightness

      public JDialogBrightness(JFrame parent, ViewJComponentColocalizationEM compImage, int bright, float con)
      Creates new dialog for entering brightness and contrast.
      Parameters:
      parent - Parent frame.
      compImage - Component image to change.
      bright - Initial brightness.
      con - Initial contrast.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent evt)
      DOCUMENT ME!
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      evt - DOCUMENT ME!
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Sets values based on knob along slider.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - Event that triggered this function
    • init

      private void init(int brightness, float contrast)
      Initializes GUI components and displays dialog.

      For the brightnessSlider the slider values and the brightness values are identical. brightness is an offset going from -255 to 255. This is enough to change all 0 values to 255 and all 255 values to 0. brightness is added to all contrast scaled red, green, and blue.

      However, for the contrastSlider the slider values are different from the contrast values. The contrast values go from 0.1 to 10.0 while the slider values go from -200 to 200. contrast = (float)Math.pow(10.0,contrastSlider.getValue()/200.0) The original red, green, and blue are mutliplied by contrast.

      Parameters:
      brightness - Initial brightness.
      contrast - Initial contrast.