net.sourceforge.jiu.gui.awt.dialogs

Class MedianCutDialog

Implemented Interfaces:
ActionListener, ItemListener, KeyListener

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

Field Summary

int[]
ERROR_DIFFUSION_STRINGS
int[]
ERROR_DIFFUSION_TYPES
int[][]
METHODS
private Choice
algorithms
private Button
cancel
private Choice
errorDiffusion
private TextField
numColorsField
private TextField
numPassesField
private Button
ok
private Choice
outputColorType
private boolean
pressedOk
private Choice
reprColorMethod
private TextField
tauField

Constructor Summary

MedianCutDialog(Frame owner, Strings strings, int numColors, int representativeColorMethod, boolean paletted, int numPasses, double initialTau)
Creates a modal dialog to enter the parameter.

Method Summary

void
actionPerformed(ActionEvent e)
Hides (closes) this dialog if the OK button was source of the action event (e.g.
void
center()
Centers the dialog on screen.
private double
getDoubleValue(TextField textField)
int
getErrorDiffusion()
private int
getIntValue(TextField textField)
int
getNumColors()
int
getNumPasses()
int
getReprColorMethod()
double
getTau()
boolean
hasPressedOk()
boolean
isOutputTypePaletted()
void
itemStateChanged(ItemEvent event)
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
private void
updateOkButton()
private void
updateStates()
boolean
useContourRemoval()
boolean
useErrorDiffusion()

Field Details

ERROR_DIFFUSION_STRINGS

public final int[] ERROR_DIFFUSION_STRINGS

ERROR_DIFFUSION_TYPES

public final int[] ERROR_DIFFUSION_TYPES

METHODS

public final int[][] METHODS

algorithms

private Choice algorithms

cancel

private Button cancel

errorDiffusion

private Choice errorDiffusion

numColorsField

private TextField numColorsField

numPassesField

private TextField numPassesField

ok

private Button ok

outputColorType

private Choice outputColorType

pressedOk

private boolean pressedOk

reprColorMethod

private Choice reprColorMethod

tauField

private TextField tauField

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).

center

public void center()
Centers the dialog on screen.

getDoubleValue

private double getDoubleValue(TextField textField)

getErrorDiffusion

public int getErrorDiffusion()

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)

keyPressed

public void keyPressed(KeyEvent e)

keyReleased

public void keyReleased(KeyEvent e)

keyTyped

public void keyTyped(KeyEvent e)

updateOkButton

private void updateOkButton()

updateStates

private void updateStates()

useContourRemoval

public boolean useContourRemoval()

useErrorDiffusion

public boolean useErrorDiffusion()