Exercise 1: Creating The ChatClient GUI Part 1 (Level 1)

In this exercise, you will create a GUI for  a chat room application. You will use a complex layout to position properly several GUI components in a frame.

 
Figure 10-1 show the GUI design that you will attempt to achieve.

                Figure 10 -1  GUI Layout for the ChatClient Application

 

As shown in Figure 10-1, there are four components in this GUI. The main component is TextArea. The bottom component is a TextField. There are two Button components on the right. You will need to refer to the AWT Components handout for instructions on how to use the text components. Your instructor will provide this handout.

 

 

Preparation 

Before you begin, make sure that you have changed directories to projects/ChatRommPrj/ using the  cd command in the terminal window.

cd ~/projects/ChatRoomPjr/

 

 

Task 1 - Creating the ChatClient Program

Using a text editor, create the ChatClient class source file in the project directory. This class must implement the GUI desing in Figure 10 - 1 on page Lab 10 - 2.

 

 

Task 2 - Compiling the ChatClient Program

On the command line, use the javac command to compile the ChatClient program.

 

Task 3 - Running the ChatClient Program

On the command line, use the java command to run the ChatClient program. You should see the GUI shown in Figure 10 - 1 on page Lab 10 - 2. If your GUI does not look exactly like the figure, then edit the code to tweak the design to match this figure.