Java Swing – GRAPHICAL USER INTERFACES (GUIs)
TOPIC 01 – BASIC GUI APPLICATIONS


 

LESSON WORK

 

QUESTION #0

Associate each GUI terminology term with its description on the right.

 

 

a)    pack()

b)    GridLayout

c)     JPanel

 

d)    JFrame

e)    Event-driven programming

 

f)      GUI

 

g)    FlowLayout

h)    Component

i)      Container

 



1)    Basic part of a GUI such as a button, a text field or a label.

2)    Type of programming where the program waits for a type of event such as a mouse click or a collision to happen and then responds to it.

 

3)    The class that provides a window on the screen.  It is also the class that we extend to create a GUI application.

4)    A component whose purpose is to contain other components. 

5)    Graphic User Interface

6)    A layout manager that organizes components in a single row until there is no room and then expands to another row.  This is the default layout manager for JPanels.

7)    A layout manager that separates the area into cells based on the specified number of rows and columns and placing one component in each cell of the grid.

8)    A component that can be drawn to and that can also contain other components.  This component can also have its own layout manager.

9)    A method that reduces the window size to the required size needed to fit all components.

 


QUESTION #1


Creating the following GUI consisting of 3 labels, 3 text fields and 4 buttons:

Note 1: You might want to create a JPanel for each row and place each JPanel inside a GridLayout.

Note 2: We will make this application become interactive in the next lesson.


QUESTION #2 (SMALL PROJECT)

Create a simple GUI that looks like a calculator.  Your calculator will need similar buttons to the one in the image below.  Note that you may want to research different layouts or read ahead in the lessons.