Other Top Part of Screen Items
| [Previous] [Main] [Next] |
Other Top Part of Screen items.
· | Instantiate the component - Bounded Text Field Example - declare the field
·
|
· | Set ToolTips and Assistive Technology name/description - Bounded Text Field Example - set ToolTips and Assistive Technology
|
· | Add to layout manager - Bounded Text Field Example - add to layout manager
|
· | Test for data if a required field - Bounded Text Field Example - Test for data if required
|
· | Test if data changed, set up SQL Update and Insert strings - Bounded Text Field Example - Test if data changed, set up update & insert strings
·
|
· | Fill component from resultSet - Bounded Text Field Example - Fill component from resultSet
|
· | Reset the string that holds the original value if data is saved to SQL table - Bounded Text Field Example - Reset hld value to value in component after save
|
· | Set component to default value from SQL table when the CLEAR button is pressed - Bounded Text Field Example - Set component to default value when CLEAR is pressed
|
· | Add to layout manager - Bounded Text Field Example - add to layout manager
|
· | Method to create dashed red border - Bounded Text Field Example - add to layout manager
|
The reason for using a dashed border is for color blind users who cannot see the red border.
|
· | Add to layout manager - Bounded Text Field Example - add to layout manager
|
Most components have either setEditable(boolean) and/or setEnabled(boolen) methods.
|
· | Set ToolTips and Assistive Technology name/description - Bounded Text Field Example - set ToolTips and Assistive Technology
|
· | Set JFormattedTextfield mask - Telephone - set JFormattedTextfield mask - This also sets a default phone number (e.g. (000) 000-0000) the user can type over. RegEx masks are almost required to work this way and formatted masks are easier for users to visualize when they have a target format in front of them. These are stored in the resource bundle so they can be changed from one locale to another.
|
Code is also generated here to demonstrate moving the caret position to a certain location when the field gains focus. Note that it requires both a mouselistener and a focuslistener.
|
· | Check for data if this is a required field - this is just like the text for a bounded text field, except JFormattedtextfields can use x.getValue().toString() instead of x.getText() when retrieving data from the component.
|
· | Get data from component - set default (e.g. (000) 000-0000) to blank - Telephone - get data from component
|
· | Get data from SQL resultSet - Telephone - get data from SQL resultSet - note that a JFormattedTextField must use x.setValue(string) instead of x.setText(string) to put data into the component. x.setText(string) will work but always rings the "invalid data" bell.
|
· | Resetting the hld string is just like the Bounded Text field.
|
· | Set phone to default phone number when screen is cleared getting ready for an ADD - Telephone - set phone to default value with CLEAR button is pressed
|
|
9. Hot Key Associated with JTextFields |
|
· | Add to layout manager - Bounded Text Field Example - add to layout manager
|
Note that the hot keys are stored in the resource bundle. This allows the hot key letter to be changed from one language to the next. The letter used for a hot key in one language may not even be present in the word used in another language.
|
|
· | Fill component from resultSet - Bounded Text Field Example - Fill component from resultSet
|
Look at the UserLogDataTableModel file to set how the data is loaded directly from the resultSet rather than being loaded into a vector or Arraylist.
|
|
14. Generating a JUnit TestCase program to test the GUI
|
More on this later.
|