Week 3 Java Program II DB
Contents GUI DESIGN 2 Java Swing Components Suitability 2 Sales Representative User Interface 2 PSEUDOCODE 3 ACTION_ENTER 3 ACTION_QUIT 4 REFERENCES 5
GUI DESIGN
Java Swing Components Suitability
|
FIELD |
SWING COMPONENT |
SUITABILITY |
|
· Sales Representative ID · Representative First Name · Representative Last Name · Office Supplies Sales · Book Sales · Paper Sales |
JTextField (One for each field) |
Suitable for entry and display of short string values. These fields will all hold values that are no more than a few characters and therefore can be displayed in only one short line within a text box component. |
|
· Sales Districts |
Grouped JRadioButtons (One for each district) |
Suitable where there are multiple options to choose from and the user is allowed to select only one option |
|
· Means of Contact |
JCheckBox (One for each option) |
Suitable where there are multiple options to choose from and the user is allowed to select more than one option |
|
· Quit Application · Submit Entries |
JButton (One for each function) |
Suitable for triggering action events |
Means of Contact:
Sales District:
QUIT
ENTER
West
East
South
North
Last Name:
Representative ID:
Papers:
Books:
Office Supplies:
Sales Representative User Interface
First Name:
Phone
Visit
PSEUDOCODE
Variables : rep_id, first_name, last_name, office_supplies, book_sales, paper_sales, district, phone, email, visit;
ACTION_ENTER
{
IF (All required fields have been filled)
SET rep_id;
SET first_name;
SET last_name;
SET office_supplies;
SET book_sales;
SET paper_sales;
SET phone;
SET email;
SET visit;
IF (North isSelected) SET district = North;
ELSE IF (South isSelected) SET district = South;
ELSE IF (EAST isSelected) SET district = East;
ELSE SET district = West;
ELSE
Prompt user to enter missing values
}
ACTION_QUIT
{
IF (there are pending changes)
Prompt to SAVE;
EXIT App;
}
REFERENCES
1. Starting Out With Java From Control Structures Through Objects (5TH Edition) – Tony Gaddis
Chapter 12 (A First Look at GUI Applications)