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:
- Prompt : Multi-lines prompts support. (separted by '\n')
- Button management : Getting the index of buttons which user press, except :
Ok, Cancel , Apply , No , Close , Done ,
for they have identities of their own.
- Message support : the status text field to show custom message (ex. error message)
Overide setCentralPanel() to show user components.
- Version:
- 0.4 Jul 8, 1999
- Author:
- Ding-Yi Chen
- See Also:
- Frame, GenericDialog
-
Apply
- Indicate the "Apply" button.
-
buttonPanel
- The panel that contain the buttons.
-
buttonPrompt
- The prompt of the buttons.
-
buttons
- The buttons list.
-
Cancel
- Indicate the "Cancel" button.
-
centralPanel
- The panel that contain the user components.
-
Close
- Indicate the "Close" button.
-
defaultButtonPrompt
- The default prompt of the buttons.
-
dialogReturn
- Indicate the index of the button clicked by user.
-
Done
- Indicate the "Done" button.
-
msgField
- The textField to show status message.
-
msgLength
- The length of msgField.
-
msgPanel
- The panel that contain the status message.
-
No
- Indicate the "No" button.
-
Ok
- Indicate the "Ok" button.
-
promptPanel
- The panel that contain the prompts.
-
promptText
- The prompt.
-
GenericFrame()
- Construct a GenericFrame.
-
GenericFrame(String, String)
- Construct a GenericFrame.
-
GenericFrame(String, String, int)
- Construct a GenericFrame.
-
GenericFrame(String, String, String[])
- Construct a GenericFrame without message
-
GenericFrame(String, String, String[], int)
- Construct a GenericFrame.
-
actionPerformed(ActionEvent)
- Invoked when an action occurs.
-
checkFormat()
- Check if the input format valid.
-
getDialogReturn()
- Getting the index of buttons which user press.
-
getDoubleFieldValue(TextField, String)
- Creates a Double representation of the specified TextField.
-
getDoubleFieldValue(TextField, String, double, double)
- Creates a Double representation of the specified TextField.
-
getIntegerFieldValue(TextField, String, int, int)
- Creates a Integer representation of the specified TextField.
-
init()
- Initize the GenericFrame, call by constructor.
-
setAllPanel()
- Initite contents of this frame.
-
setButtonPanel()
- Initite the buttonPanel.
-
setCentralPanel()
- Initite the centralPanel.
-
setMsg(String)
- Set the message field by specified string.
-
setMsgPanel()
- Initite the msgPanel.
-
setPromptPanel()
- Initite the promptPanel.
Cancel
public static final int Cancel
- Indicate the "Cancel" button.
Apply
public static final int Apply
- Indicate the "Apply" button.
Done
public static final int Done
- Indicate the "Done" button.
Ok
public static final int Ok
- Indicate the "Ok" button.
No
public static final int No
- Indicate the "No" button.
Close
public static final int Close
- Indicate the "Close" button.
promptPanel
protected Panel promptPanel
- The panel that contain the prompts.
centralPanel
protected Panel centralPanel
- The panel that contain the user components.
buttonPanel
protected Panel buttonPanel
- The panel that contain the buttons.
msgPanel
protected Panel msgPanel
- The panel that contain the status message.
promptText
protected String promptText
- The prompt.
buttons
protected Button buttons[]
- The buttons list.
msgField
protected TextField msgField
- The textField to show status message.
msgLength
protected int msgLength
- The length of msgField.
buttonPrompt
protected String buttonPrompt[]
- The prompt of the buttons.
defaultButtonPrompt
public static final String defaultButtonPrompt[]
- The default prompt of the buttons.
dialogReturn
protected int dialogReturn
- Indicate the index of the button clicked by user.
GenericFrame
public GenericFrame()
- Construct a GenericFrame.
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.
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.
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.
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.
init
protected void init()
- Initize the GenericFrame, call by constructor.
setPromptPanel
protected void setPromptPanel()
- Initite the promptPanel.
- See Also:
- promptPanel
setButtonPanel
protected void setButtonPanel()
- Initite the buttonPanel.
- See Also:
- buttonPanel
setMsgPanel
protected void setMsgPanel()
- Initite the msgPanel.
- See Also:
- msgPanel
setCentralPanel
protected void setCentralPanel()
- Initite the centralPanel.
Override this method to put custom components.
- See Also:
- centralPanel
setAllPanel
protected void setAllPanel()
- Initite contents of this frame.
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.
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.
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.
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.
setMsg
public void setMsg(String msg)
- Set the message field by specified string.
- Parameters:
- msg - The specified string.
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.
actionPerformed
public void actionPerformed(ActionEvent event)
- Invoked when an action occurs.
All Packages Class Hierarchy This Package Previous Next Index