All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tw.edu.ncnu.im.cnclab.UI.GenericDialog

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog
                                   |
                                   +----tw.edu.ncnu.im.cnclab.UI.GenericDialog

public class GenericDialog
extends Dialog
implements ActionListener
The GenericDialog class implements the extened dialog input window.

Feature of GenericDialog:

Overide setCentralPanel() to show user components.

Version:
0.4 Jul 8, 1999
Author:
Ding-Yi Chen
See Also:
Dialog, GenericFrame

Variable Index

 o Apply
Indicate the "Apply" button.
 o buttonPanel
The panel that contain the buttons.
 o buttonPrompt
The prompt of the buttons.
 o buttons
The buttons list.
 o Cancel
Indicate the "Cancel" button.
 o centralPanel
The panel that contain the user components.
 o Close
Indicate the "Close" button.
 o defaultButtonPrompt
The default prompt of the buttons.
 o dialogReturn
Indicate the index of the button clicked by user.
 o Done
Indicate the "Done" button.
 o msgField
The textField to show status message.
 o msgLength
The length of msgField.
 o msgPanel
The panel that contain the status message.
 o No
Indicate the "No" button.
 o Ok
Indicate the "Ok" button.
 o promptPanel
The panel that contain the prompts.
 o promptText
The prompt.

Constructor Index

 o GenericDialog(Frame, String, String, boolean)
Construct a GenericDialog without message textField.
 o GenericDialog(Frame, String, String, boolean, int)
Construct a GenericDialog.
 o GenericDialog(Frame, String, String, boolean, String[])
Construct a GenericDialog without message
 o GenericDialog(Frame, String, String, boolean, String[], int)
Construct a GenericDialog.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action occurs.
 o checkFormat()
Check if the input format valid.
 o getArg(Object[])
Return the parameters of the Dialog get.
 o getDialogReturn()
Getting the index of buttons which user press.
 o getDoubleFieldValue(TextField, String)
Creates a Double representation of the specified TextField.
 o getDoubleFieldValue(TextField, String, double, double)
Creates a Double representation of the specified TextField.
 o getIntegerFieldValue(TextField, String, int, int)
Creates a Integer representation of the specified TextField.
 o init()
Initize the GenericDialog, call by constructor.
 o setAllPanel()
Initite contents of this dialog.
 o setButtonPanel()
Initite the buttonPanel.
 o setCentralPanel()
Initite the custom panel(central)Panel.
 o setMsg(String)
Set the message field by specified string.
 o setMsgPanel()
Initite the msgPanel.
 o setPromptPanel()
Initite the promptPanel.

Variables

 o Cancel
 public static final int Cancel
Indicate the "Cancel" button.

 o Apply
 public static final int Apply
Indicate the "Apply" button.

 o Done
 public static final int Done
Indicate the "Done" button.

 o Ok
 public static final int Ok
Indicate the "Ok" button.

 o No
 public static final int No
Indicate the "No" button.

 o Close
 public static final int Close
Indicate the "Close" button.

 o promptPanel
 protected Panel promptPanel
The panel that contain the prompts.

 o centralPanel
 protected Panel centralPanel
The panel that contain the user components.

 o buttonPanel
 protected Panel buttonPanel
The panel that contain the buttons.

 o msgPanel
 protected Panel msgPanel
The panel that contain the status message.

 o promptText
 protected String promptText
The prompt.

 o buttons
 protected Button buttons[]
The buttons list.

 o msgField
 protected TextField msgField
The textField to show status message.

 o msgLength
 protected int msgLength
The length of msgField.

 o buttonPrompt
 protected String buttonPrompt[]
The prompt of the buttons.

 o defaultButtonPrompt
 public static String defaultButtonPrompt[]
The default prompt of the buttons.

 o dialogReturn
 protected int dialogReturn
Indicate the index of the button clicked by user.

Constructors

 o GenericDialog
 public GenericDialog(Frame fr,
                      String title,
                      String promptText,
                      boolean isModal)
Construct a GenericDialog without message textField.

Parameters:
fr - the parent window.
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
isModal - whether the dialog modal.
 o GenericDialog
 public GenericDialog(Frame fr,
                      String title,
                      String promptText,
                      boolean isModal,
                      int msgLength)
Construct a GenericDialog.

Parameters:
fr - the parent window.
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
isModal - whether the dialog modal.
msgLength - specify the length of the message textField.
 o GenericDialog
 public GenericDialog(Frame fr,
                      String title,
                      String promptText,
                      boolean isModal,
                      String buttonPrompt[])
Construct a GenericDialog without message

Parameters:
fr - the parent window.
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
isModal - whether the dialog modal.
buttonPrompt - the prompt of buttons.
 o GenericDialog
 public GenericDialog(Frame fr,
                      String title,
                      String promptText,
                      boolean isModal,
                      String buttonPrompt[],
                      int msgLength)
Construct a GenericDialog.

Parameters:
fr - the parent window.
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
isModal - whether the dialog modal.
buttonPrompt - the prompt of buttons.
msgLength - specify the length of the message textField.

Methods

 o init
 protected void init()
Initize the GenericDialog, call by constructor.

 o setPromptPanel
 protected void setPromptPanel()
Initite the promptPanel.

See Also:
promptPanel
 o setButtonPanel
 protected void setButtonPanel()
Initite the buttonPanel.

See Also:
buttonPanel
 o setMsgPanel
 protected void setMsgPanel()
Initite the msgPanel.

See Also:
msgPanel
 o setCentralPanel
 protected void setCentralPanel()
Initite the custom panel(central)Panel.

Override this method to put custom components.

See Also:
centralPanel
 o setAllPanel
 protected void setAllPanel()
Initite contents of this dialog.

 o getIntegerFieldValue
 public Integer getIntegerFieldValue(TextField tf,
                                     String fieldStandFor,
                                     int lowerBound,
                                     int upperBound)
Creates a Integer representation of the specified TextField.

Parameters:
tf - The TextField.
fieldStandFor - The meaning of the field stand for.
lowerbound - The lower bound of the integer value.
upperbound - The upper bound of the integer value.
Returns:
Integer represention of the specified TextField ; null if invalid format or out of bound.
 o getDoubleFieldValue
 protected Double getDoubleFieldValue(TextField tf,
                                      String fieldStandFor)
Creates a Double representation of the specified TextField.

Parameters:
tf - The TextField.
fieldStandFor - The meaning of the field stand for.
Returns:
Double represention of the specified TextField ; null if invalid format or out of bound.
 o getDoubleFieldValue
 protected Double getDoubleFieldValue(TextField tf,
                                      String fieldStandFor,
                                      double lowerBound,
                                      double upperBound)
Creates a Double representation of the specified TextField.

Parameters:
tf - The TextField.
fieldStandFor - The meaning of the field stand for.
lowerbound - The lower bound of the double value.
upperbound - The upper bound of the double value.
Returns:
Double represention of the specified TextField ; null if invalid format or out of bound.
 o checkFormat
 protected boolean checkFormat()
Check if the input format valid.

Override this method to do an additional check.

It returns true itself. Keep it alone if check is not required.

Returns:
true if inputs is valid; false if otherwise.
 o setMsg
 public void setMsg(String msg)
Set the message field by specified string.

Parameters:
msg - The specified string.
 o getDialogReturn
 public int getDialogReturn()
Getting the index of buttons which user press.

Getting the index of buttons which user press, except : Ok, Cancel , Apply , No , Close , Done , for they have identities of their own.

Returns:
the index of buttons which user press.
 o actionPerformed
 public void actionPerformed(ActionEvent event)
Invoked when an action occurs.

 o getArg
 public Object[] getArg(Object additionalArg[])
Return the parameters of the Dialog get.

Developers may using this method to feed the another method directly. For example, Algorithm.setArg(Object[]) .

Parameters:
additionalArg - Additional arguments for another method.
Returns:
The parameters of the dialog get. (Default: additionalArg
See Also:
setArg

All Packages  Class Hierarchy  This Package  Previous  Next  Index