net.sourceforge.jiu.gui.awt.dialogs

Class HueSaturationValueDialog

Implemented Interfaces:
ActionListener, ItemListener, KeyListener

public class HueSaturationValueDialog
extends Dialog
implements ActionListener, ItemListener, KeyListener

A dialog to enter the parameters for an hue/saturation/value adjustment operation. Saturation and value are specified as percentage values between -100 and 100, where 0 means no change. Hue can be specified optionally (a Choice component must be checked so that the hue value will be used); it is a value between 0 and 359.
Author:
Marco Schmidt
Since:
0.5.0
See Also:
HueSaturationValue

Field Summary

private Button
cancel
private Panel
colorPanel
private TextField
hue
private Button
ok
private boolean
pressedOk
private TextField
saturation
private Checkbox
setHue
private TextField
value

Constructor Summary

HueSaturationValueDialog(Frame owner, Strings strings, boolean initialSetHue, int h, int s, int v)

Method Summary

void
actionPerformed(ActionEvent e)
Hides (closes) this dialog if the OK button was source of the action event (e.g.
int
getHue()
int
getSaturation()
int
getValue()
private int
getValue(TextComponent textField)
Attempts to convert the content of the argument text component to an int; if successful, returns that int, otherwise -1000 is returned.
boolean
hasPressedOk()
boolean
isHueSet()
void
itemStateChanged(ItemEvent e)
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
private void
updateTextFields()
Computes width and height of new image and updates the corresponding labels.

Field Details

cancel

private Button cancel

colorPanel

private Panel colorPanel

hue

private TextField hue

ok

private Button ok

pressedOk

private boolean pressedOk

saturation

private TextField saturation

setHue

private Checkbox setHue

value

private TextField value

Constructor Details

HueSaturationValueDialog

public HueSaturationValueDialog(Frame owner,
                                Strings strings,
                                boolean initialSetHue,
                                int h,
                                int s,
                                int v)
Parameters:
owner - the Frame this dialog will belong to

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

getHue

public int getHue()

getSaturation

public int getSaturation()

getValue

public int getValue()

getValue

private int getValue(TextComponent textField)
Attempts to convert the content of the argument text component to an int; if successful, returns that int, otherwise -1000 is returned.
Parameters:
textField - the text component that is supposed to hold an int value
Returns:
int representation of the text component's data

hasPressedOk

public boolean hasPressedOk()

isHueSet

public boolean isHueSet()

itemStateChanged

public void itemStateChanged(ItemEvent e)

keyPressed

public void keyPressed(KeyEvent e)

keyReleased

public void keyReleased(KeyEvent e)

keyTyped

public void keyTyped(KeyEvent e)

updateTextFields

private void updateTextFields()
Computes width and height of new image and updates the corresponding labels. The labels will either display width and height or a single dash if the data in the text fields is invalid.