Question: Needs to be implemented using JAVA , please i need help You need to create the following class that extends JFrame: public class ServerGUI extends
Needs to be implemented using JAVA , please i need help
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.
Getters
public JTextField getTextFieldAt(int index)
Retrieves the corresponding JTextField based in input parameter index. The following valid values for index should be utilized:
0 Port # JTextField
1 Timeout JTextField
The purpose of these two JTextFields will become clear in lab2out.
public JLabel getStatus()
Returns the top JLabel of the GUI (initialized to Not Connected)
public JTextArea getLog()
Returns the JTextArea pertaining to the Servers Log. The log area contains all data received from the client as informational messages
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
JLabel JTextField JTextField Server Status: Not Connected Port # Timeout Server Log Below JLabel JTextArea(should be contained within a JSCrollPane so scroll bars can be added as needed) JButtons Listen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
