CSBP 221 - Programming Lab I Fall 2021: Exercise 1
CSBP 221 - Programming Lab I Fall 2021: Exercise 1
CSBP 221 - Programming Lab I Fall 2021: Exercise 1
Fall 2021
Lab 4
Objective: The exercises in this document introduce the Graphical User Interface (GUI) in Java. Mapping
to CLO #4
Exercise 1
1. Create a simple Graphical User Interface (GUI): Create new JFrameForm and use the
Palette to drag and drop the Swing Containers and Controllers like the figure shown. Your
Form should accept number in its text field as Month. When the user press Convert Button,
the corresponding Higri Month Name has to be displayed in the Label, otherwise, the Label
text has to indicate that the number entered is invalid
Exercise 2
Create a simple Graphical User Interface (GUI) to calculate the BMI for a person given his height
and weight. Build the following frame using Netbeans jFrame and implement the two button
handlers.
Exercise 3.a
Create a simple Graphical User Interface (GUI): Create new JFrameForm with a label,
a text field, a text area, and a button. Each time the button is clicked, the word in the
text field is appended to the text area. Here is the example of the user adding the strings
“One”, “Two”, “Three”, and “Four” in sequence.
Exercise 3.b
Repeat Exercise # 3.a in another frame, with the word added at the beginning of
the Text Area. So after adding “One”, “Two”, “Three”, and “Four” in sequence,
the text area should have “Four Three Two One”
Exercise 4
1. Design the above frame. The Combo Box has numbers from 1 until 10. The first selected
number is 1.
2. Declare a variable called “num” that is initialized with the constructor of the frame to 1.
3. Each time the combo box changes selection, the “num” value changes to its current
selection, and the text area is cleared.
4. The text area is updated each time one of the two buttons is pressed. If the button
“Increment” is pressed, the number is incremented and appended to the text area. If the
button “Decrement” is pressed, the number is decremented and appended to the text
area.
Exercise 5
1. Create a simple Currency Converter GUI frame as shown below to convert an
amount of money between Dirhams and Dollars. The conversion way is selected
by a combo box.