Gui interface
//Usually you will require both swing and awt packages
// even if you are working with just swings.
import [Link].*;
import [Link].*;
class gui {
public static void main(String args[]) {
//Creating the Frame
JFrame frame = new JFrame("Chat Frame");
[Link](JFrame.EXIT_ON_CLOSE);
[Link](400, 400);
//Creating the MenuBar and adding components
JMenuBar mb = new JMenuBar();
JMenu m1 = new JMenu("FILE");
JMenu m2 = new JMenu("Help");
[Link](m1);
[Link](m2);
JMenuItem m11 = new JMenuItem("Open");
JMenuItem m22 = new JMenuItem("Save as");
[Link](m11);
[Link](m22);
//Creating the panel at bottom and adding components
JPanel panel = new JPanel(); // the panel is not visible in output
JLabel label = new JLabel("Enter Text");
JTextField tf = new JTextField(10); // accepts upto 10 characters
JButton send = new JButton("Send");
JButton reset = new JButton("Reset");
[Link](label); // Components Added using Flow Layout
[Link](label); // Components Added using Flow Layout
[Link](tf);
[Link](send);
[Link](reset);
// Text Area at the Center
JTextArea ta = new JTextArea();
//Adding Components to the frame.
[Link]().add([Link], panel);
[Link]().add([Link], mb);
[Link]().add([Link], ta);
[Link](true);
}
}