net.sourceforge.jiu.gui.awt.dialogs

Class ScaleDialog

Implemented Interfaces:
ActionListener, KeyListener

public class ScaleDialog
extends Dialog
implements ActionListener, KeyListener

A dialog to enter the parameters for an image scaling operation.
Author:
Marco Schmidt

Field Summary

private Button
cancel
private TextComponent
heightTextField
private Checkbox
maintainAspectRatio
private Button
ok
private int
oldHeight
private String
oldHeightString
private int
oldWidth
private String
oldWidthString
private boolean
pressedOk
private int
type
private Choice
types
private TextComponent
widthTextField

Constructor Summary

ScaleDialog(Frame owner, Strings strings, int width, int height, boolean pickType, String[] typeNames, int initialType)
Creates an InfoDialog, a modal dialog to display a text message, centered on the desktop.

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.
int
getHeightValue()
int
getType()
private int
getValue(TextComponent textField)
int
getWidthValue()
void
handleKeys(KeyEvent e)
boolean
hasPressedOk()
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)

Field Details

cancel

private Button cancel

heightTextField

private TextComponent heightTextField

maintainAspectRatio

private Checkbox maintainAspectRatio

ok

private Button ok

oldHeight

private int oldHeight

oldHeightString

private String oldHeightString

oldWidth

private int oldWidth

oldWidthString

private String oldWidthString

pressedOk

private boolean pressedOk

type

private int type

types

private Choice types

widthTextField

private TextComponent widthTextField

Constructor Details

ScaleDialog

public ScaleDialog(Frame owner,
                   Strings strings,
                   int width,
                   int height,
                   boolean pickType,
                   String[] typeNames,
                   int initialType)
Creates an InfoDialog, a modal dialog to display a text message, centered on the desktop.
Parameters:
owner - the Frame this dialog will belong to
strings - the Strings resource used for text messages
width - the current width of the image
height - the current height of the image
pickType - determines whether the will be a Choice box for picking the type of scaling algorithm
typeNames - names of the image scaling algorithms
initialType - algorithm type to be initially selected

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.

getHeightValue

public int getHeightValue()

getType

public int getType()

getValue

private int getValue(TextComponent textField)

getWidthValue

public int getWidthValue()

handleKeys

public void handleKeys(KeyEvent e)

hasPressedOk

public boolean hasPressedOk()

keyPressed

public void keyPressed(KeyEvent e)

keyReleased

public void keyReleased(KeyEvent e)

keyTyped

public void keyTyped(KeyEvent e)