net.sourceforge.jiu.gui.awt.dialogs

Class IntegerDialog

Implemented Interfaces:
ActionListener, AdjustmentListener, KeyListener

public class IntegerDialog
extends Dialog
implements ActionListener, AdjustmentListener, KeyListener

An AWT dialog to select an int value from a given interval.
Author:
Marco Schmidt

Field Summary

private Button
cancel
private int
maxValue
private int
minValue
private Button
ok
private Integer
result
private Scrollbar
scrollbar
private TextComponent
valueTextField

Constructor Summary

IntegerDialog(Frame owner, String title, String message, int minValue, int initialValue, int maxValue, String okText, String cancelText)
Creates an IntegerDialog, a modal dialog that lets the user select one int value from a given interval.

Method Summary

void
actionPerformed(ActionEvent e)
Hides (closes) this dialog if the OK button was source of the action event (e.g.
void
adjustmentValueChanged(AdjustmentEvent e)
Integer
getValue()
void
handleKeys(KeyEvent e)
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
private void
setScrollbarFromTextField()

Field Details

cancel

private Button cancel

maxValue

private int maxValue

minValue

private int minValue

ok

private Button ok

result

private Integer result

scrollbar

private Scrollbar scrollbar

valueTextField

private TextComponent valueTextField

Constructor Details

IntegerDialog

public IntegerDialog(Frame owner,
                     String title,
                     String message,
                     int minValue,
                     int initialValue,
                     int maxValue,
                     String okText,
                     String cancelText)
Creates an IntegerDialog, a modal dialog that lets the user select one int value from a given interval.
Parameters:
owner - the java.awt.Frame this dialog will belong to
title - the text that will be displayed in the title bar of the dialog
message - the message text that will be displayed in the upper part of the dialog
minValue - the minimum allowed int value to be selected by the user
initialValue - the int value that is selected when the dialog first pops up
maxValue - the maximum allowed int value to be selected by the user
okText - the value for OK (just "OK" in English programs, may be different for other natural languages
cancelText - the value for Cancel (just "Cancel" in English programs, may be different for other natural languages

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

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)

getValue

public Integer getValue()

handleKeys

public void handleKeys(KeyEvent e)

keyPressed

public void keyPressed(KeyEvent e)

keyReleased

public void keyReleased(KeyEvent e)

keyTyped

public void keyTyped(KeyEvent e)

setScrollbarFromTextField

private void setScrollbarFromTextField()