net.sourceforge.jiu.gui.awt.dialogs
Class CropDialog
Dialog
net.sourceforge.jiu.gui.awt.dialogs.CropDialog
- ActionListener, KeyListener
public class CropDialog
extends Dialog
implements ActionListener, KeyListener
A dialog to enter the parameters for an image crop operation.
void | actionPerformed(ActionEvent e) - Hides (closes) this dialog if the OK button was source of the action event
(e.g.
|
int | getHeight()
|
private int | getValue(TextComponent textField) - Attempts to convert the content of the argument text component
to an
int ; if successful, returns that int, otherwise
-1 is returned.
|
int | getWidth() - Returns the width of the to-be-cropped image as given by the
current values in the text fields for left column and right column.
|
int | getX1()
|
int | getX2()
|
int | getY1()
|
int | getY2()
|
boolean | hasPressedOk()
|
void | keyPressed(KeyEvent e)
|
void | keyReleased(KeyEvent e)
|
void | keyTyped(KeyEvent e)
|
private void | updateLabels() - Computes width and height of new image and updates the
corresponding labels.
|
cancel
private Button cancel
newHeight
private Label newHeight
newWidth
private Label newWidth
pressedOk
private boolean pressedOk
CropDialog
public CropDialog(Frame owner,
Strings strings,
int width,
int height)
owner
- the Frame this dialog will belong tostrings
- Strings resource to be used for text messageswidth
- width of the original image, before cropping; this is used to
determine the valid values for left and right column, from 0 to width - 1height
- height of the original image, before cropping; this is used to
determine the valid values for top and bottom row, from 0 to height - 1
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).
getHeight
public int getHeight()
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
-1 is returned.
textField
- the text component that is supposed to hold an int value
- int representation of the text component's data
getWidth
public int getWidth()
Returns the width of the to-be-cropped image as given by the
current values in the text fields for left column and right column.
Computes the width from those values and returns it or returns -1
if the data in the text fields is not valid for some reason.
- width of cropped image or -1 if information is invalid
hasPressedOk
public boolean hasPressedOk()
keyPressed
public void keyPressed(KeyEvent e)
keyReleased
public void keyReleased(KeyEvent e)
keyTyped
public void keyTyped(KeyEvent e)
updateLabels
private void updateLabels()
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.