All Packages  Class Hierarchy  This Package  Previous  Next  Index

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

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

public class GenericFrame
extends Frame
implements ActionListener
The GenericFrame class implements the extened dialog input window.

Feature of GenericFrame:

Overide setCentralPanel() to show user components.

Version:
0.4 Jul 8, 1999
Author:
Ding-Yi Chen
See Also:
Frame, GenericDialog

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 GenericFrame()
Construct a GenericFrame.
 o GenericFrame(String, String)
Construct a GenericFrame.
 o GenericFrame(String, String, int)
Construct a GenericFrame.
 o GenericFrame(String, String, String[])
Construct a GenericFrame without message
 o GenericFrame(String, String, String[], int)
Construct a GenericFrame.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action occurs.
 o checkFormat()
Check if the input format valid.
 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 GenericFrame, call by constructor.
 o setAllPanel()
Initite contents of this frame.
 o setButtonPanel()
Initite the buttonPanel.
 o setCentralPanel()
Initite the centralPanel.
 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 final String defaultButtonPrompt[]
The default prompt of the buttons.

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

Constructors

 o GenericFrame
 public GenericFrame()
Construct a GenericFrame.

 o GenericFrame
 public GenericFrame(String title,
                     String promptText)
Construct a GenericFrame.

Parameters:
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
 o GenericFrame
 public GenericFrame(String title,
                     String promptText,
                     int msgLength)
Construct a GenericFrame.

Parameters:
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
msgLength - specify the length of the message textField.
 o GenericFrame
 public GenericFrame(String title,
                     String promptText,
                     String buttonPrompt[])
Construct a GenericFrame without message

Parameters:
title - the window title.
promptText - the prompt text. '\n' can be used as separator.
buttonPrompt - the prompt of buttons.
 o GenericFrame
 public GenericFrame(String title,
                     String promptText,
                     String buttonPrompt[],
                     int msgLength)
Construct a GenericFrame.

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

Methods

 o init
 protected void init()
Initize the GenericFrame, 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 centralPanel.

Override this method to put custom components.

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

 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.


All Packages  Class Hierarchy  This Package  Previous  Next  Index