Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I was having trouble trying to figure how to do this assigment . If anyone could please help public class ClientGUI extends JFrame { private
I was having trouble trying to figure how to do this assigment . If anyone could please help
public class ClientGUI extends JFrame
{
private JLabel status;
private JButton connect;
private JButton submit;
private JButton stop;
public ClientGUI(String title)
{
int i = 0;
this.setTitle(title);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//ADD YOUR CODE HERE TO CREATE THE STATUS JLABEL AND THE JBUTTONS
}
public static void main(String[] args)
{
new ClientGUI(args[0]); //args[0] represents the title of the GUI
}
The class declaration for ClientGUI is given below: public class cexends JEcame private Label status; private JButton connect; private 3Butten submit; private Button stop; public dlientGUT(string title) int i 0; this setTitle(title); //ADD YOUR CODE HERE TO CREATE THE STATUS JLABEL AND THE JBUTTONS public static void main(string[] acgs) new ClientGUI (args[o]); //args[0] represents the title of the GUI Perform the following steps when creating the GUI (inserted beneath //ADD YOUR CODE HERE TO CREATE THE STATUS JLABEL AND THE JBUTTONS): 1. Create a Label containing "Not Connected". Set the color of the text to Red. 2. Store the JLabel in a JPanel named "north" that implements FlowLayout as the Layout Manager 3. Create 3 JButtons 4. Store the JButtons in a JPanel named "south" that implements FlowLayout as the Layout Manager Set the Command Line Argument to "Client" and set the title. Be sure and set the close operation for the GUI (i.e., occurs when Red X in upper right corner is pressed) Event Handler Create a class named EveutHandler whose responsibility is to process the ActionEvent generated from pressing any of the 3 JButtons - Connect, Submit, Stop. You can make this class an inner class if you like. For now, just display the following messages to the console dependent upon the pressing of a given JButton: When pressing Connect display "Connect Button Pressed When pressing Submit display "Submit Button Pressed" When pressing Stop display "Stop Button Pressed" A more complete event hander will be implemented in a subsequent lab. Package The ClientGUI class must be stored in lablin package
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started