net.sourceforge.jiu.gui.awt.dialogs

Class WindowSizeDialog

Implemented Interfaces:
ActionListener, KeyListener

public class WindowSizeDialog
extends Dialog
implements ActionListener, KeyListener

A dialog to enter values for the width and height of a window (typically for a spatial filter like median or mean.
Author:
Marco Schmidt

Field Summary

private Button
cancel
private TextField
height
private Button
ok
private boolean
pressedOk
private TextField
width

Constructor Summary

WindowSizeDialog(Frame owner, Strings strings, int titleIndex, int initialWidth, int initialHeight)

Method Summary

void
actionPerformed(ActionEvent e)
Hides (closes) this dialog if the OK button was source of the action event (e.g.
int
getHeightValue()
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.
int
getWidthValue()
boolean
hasPressedOk()
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
private void
updateOkButton()

Field Details

cancel

private Button cancel

height

private TextField height

ok

private Button ok

pressedOk

private boolean pressedOk

width

private TextField width

Constructor Details

WindowSizeDialog

public WindowSizeDialog(Frame owner,
                        Strings strings,
                        int titleIndex,
                        int initialWidth,
                        int initialHeight)
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).

getHeightValue

public int getHeightValue()

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

getWidthValue

public int getWidthValue()

hasPressedOk

public boolean hasPressedOk()

keyPressed

public void keyPressed(KeyEvent e)

keyReleased

public void keyReleased(KeyEvent e)

keyTyped

public void keyTyped(KeyEvent e)

updateOkButton

private void updateOkButton()