Class MedianCutDialog

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
net.sourceforge.jiu.gui.awt.dialogs.MedianCutDialog
All Implemented Interfaces:
ActionListener, ItemListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class MedianCutDialog extends Dialog implements ActionListener, ItemListener, KeyListener
A dialog to enter the parameters for a Median Cut color quantization operation. It also allows to enter the optional algorithms that can be applied in combination with Median Cut.
Author:
Marco Schmidt
See Also:
  • Field Details

    • METHODS

      public final int[][] METHODS
    • ERROR_DIFFUSION_STRINGS

      public final int[] ERROR_DIFFUSION_STRINGS
    • ERROR_DIFFUSION_TYPES

      public final int[] ERROR_DIFFUSION_TYPES
    • ok

      private Button ok
    • cancel

      private Button cancel
    • numColorsField

      private TextField numColorsField
    • outputColorType

      private Choice outputColorType
    • reprColorMethod

      private Choice reprColorMethod
    • algorithms

      private Choice algorithms
    • errorDiffusion

      private Choice errorDiffusion
    • numPassesField

      private TextField numPassesField
    • tauField

      private TextField tauField
    • pressedOk

      private boolean pressedOk
  • Constructor Details

    • MedianCutDialog

      public MedianCutDialog(Frame owner, Strings strings, int numColors, int representativeColorMethod, boolean paletted, int numPasses, double initialTau)
      Creates a modal dialog to enter the parameter.
      Parameters:
      owner - the parent of this modal dialog
      strings - an object to get String constants in the current language
      numColors - the number of colors in the resulting image
      representativeColorMethod - the method to determine the representative color from a set of colors
      paletted - if true, the output image will be paletted, otherwise truecolor
      numPasses - number of contour removal iterations
      initialTau - maximum distance for two colors to be considered similar in contour removal
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Hides (closes) this dialog if the OK button was source of the action event (e.g. if the button was pressed).
      Specified by:
      actionPerformed in interface ActionListener
    • center

      public void center()
      Centers the dialog on screen.
    • getErrorDiffusion

      public int getErrorDiffusion()
    • getDoubleValue

      private double getDoubleValue(TextField textField)
    • getIntValue

      private int getIntValue(TextField textField)
    • getNumColors

      public int getNumColors()
    • getNumPasses

      public int getNumPasses()
    • getReprColorMethod

      public int getReprColorMethod()
    • getTau

      public double getTau()
    • hasPressedOk

      public boolean hasPressedOk()
    • isOutputTypePaletted

      public boolean isOutputTypePaletted()
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Specified by:
      itemStateChanged in interface ItemListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • updateOkButton

      private void updateOkButton()
    • updateStates

      private void updateStates()
    • useContourRemoval

      public boolean useContourRemoval()
    • useErrorDiffusion

      public boolean useErrorDiffusion()