Question: Lab 1 Out Client GUI / Server GUI Topic: Java GUI Review ( 3 0 Points ) An interface for the Client process of our

Lab 1 Out
Client GUI/Server GUI
Topic: Java GUI Review
(30 Points) An interface for the Client process of our Chat system is required. Modify the Java Class named ClientGUI (started in lab1in) so its GUI now appears as shown below:
The following datafields should now be declared in the ClientGUI class started in lab1in:
private JLabel status; //From Lab 1 In
private JButton connect; //From Lab 1 In
private JButton submit; //From Lab 1 In
private JButton stop; //From Lab 1 In
private String[] labels ={"Client ID", "Server URL", "Server Port"};
private JTextField[] textFields = new JTextField[labels.length];
private JTextArea clientArea;
private JTextArea serverArea;
(Feel free to implement other data fields if you like)
Where each data field corresponds to a newly added user interface component.
The JTextFields should be implemented as an array.
Use the labels array to set the corresponding JLabel preceding each JTextField.
The JTextArea beneath the label Enter Client Data Below corresponds to the clientArea JTextArea
The JTextArea beneath the label Received Server Data corresponds to the serverArea JTextArea
These data fields should be initialized in the ClientGUI constructor (started in lab1in) whose method header is shown below (same as lab1in):
public ClientGUI(String title)
.
Note: The Client ID field is not editable. In a future lab this client id will automatically be assigned by the Server once the client has connected to the Server. The JTextArea beneath the Received Server Data should also be set to not be editable.
ClientGUI is a public class and should extend the JFrame class (same as lab1in)
ClientGUI Class Methods
The ClientGUI class should implement the following methods (feel free to implement other methods if you like):
Constructor
public ClientGUI(String title)
Constructor for ClientGUI class. This method creates and displays the interface on page 1. The title is used for setting the title of the JFrame created by this method.
Event Handling for JButtons
The same event handler used in lab1in (e.g., EventHandler class) can also be used for lab1out. For now, the following actions should occur when pressing any of the JButtons:
When pressing Connect display Connect Button Pressed on the Console (same as lab1in)
When pressing Submit display the data entered in the JTextArea corresponding to the client data (corresponding to the clientData data field) preceded by the phrase Client Data: on the Console.
Example Console output:
Client Data: Entered Data in Client Area
When pressing Stop display Stop Button Pressed on the Console.
Server GUI Guidelines
An interface also needs to be implemented for the Server process of our Chat system. An example for the Server GUI interface is shown below:
You need to create the following class that extends JFrame:
public class ServerGUI extends JFrame
{
//Data Fields go here
//Methods go here
}
Data Fields
You should declare data fields that correspond to the status label, textFields, and the JTextArea as shown below (feel free to implement any other data fields that you like):
private JLabel status; //Initialized to Not Connected
private String[] labels ={"Port #", "Timeout"};
private JTextField[] textFields = new JTextField[labels.length];
private JTextArea log;
Methods
You should implement the following methods (feel free to implement any other methods that you like):
public ServerGUI(String title)
Constructor creates the Server GUI shown above. Input parameter title is used for setting the title bar of the Server GUI.
Event Handling for JButtons
For now, the following actions should occur when pressing the JButtons
When pressing Listen display Listen Button Pressed on the Console
When pressing Close display Close Button Pressed on the Console
When pressing Stop display Stop Button Pressed
When pressing Quit close the GUI (same as pressing the Red X in upper right corner)
Guidelines for Main
ClientGUI and ServerGUI must have their own main methods. The main methods only need to instantiate an object pertaining to each respective class.
The ClientGUIs main needs at a minimum the following statement:
new ClientGUI(args[0]);
Where args[0] corresponds to the one command line argument pertaining to the desired title of the Clients GUI
The ServerGUIs main needs at a minimum the following statement:
new ServerGUI(args[0]);
Where args[0] corresponds to the one command line argument pertaining to the desired title of the Servers GUI
Package
The ClientGUI and ServerGUI classes must be stored in lab1out package.
Running from the Command Line Argument
Run the ClientGUI and ServerGUI applications from the Command Line using lab1out.bat. This is how I will run your program as well.
Note: The ClientGUI applicatio

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!