How do you create this GUI using swing and awt components such as import java.aw
ID: 3592605 • Letter: H
Question
How do you create this GUI using swing and awt components such as import java.awt.event.*; and
import javax.swing.*;
Explanation / Answer
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
class StudentInformation{
JFrame f;
JPanel p1,p2;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
JTextField tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8,tf9,tf10,tf11;
JButton submit1,submit2;
StudentInformation()
{
f= new JFrame("GUI");
p1= new JPanel(new GridLayout(5,2);
p2= new JPanel(new GridLayout(5,2);
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,p1,p2);
l1=new JLabel("EnterName");
l2=new JLabel("Enter account number");
l3=new JLabel("Enter Street");
l4=new JLabel("Enter City");
l5=new JLabel("Enter State");
l6=new JLable("Enter Zip");
l7=new JLabel("Select Customer Type");
JRadioButton r1 = new JRadioButton("Student");
JRadioButton r2 = new JRadioButton("Facult");
JRadioButton r3 = new JRadioButton("Government");
ButtonGroup bg =new ButtonGroup();
bg.add(r1);
bg.add(r2);
l7.add(r3);
l8=new JLabel("Add new Customer");
l9=new JLabel("Enter Customer name");
l10=new JLabel("Select Course");
JComboBox<String> SelectCourse = new JComboBox<String>();
SelectCourse.addItem("select one");
l11= new JLabel("Enter Instructor ");
l12=new JLabel("Enter CourseType");
l13=new JLabel("Start Date");
l14=new JLabel("End Date");
l15=new ILabel("Add new Course");
tf1=new JTextField(12);
tf2=new JTextField(12);
tf3=new JTextField(12);
tf4=new JTextField(12);
tf5=new JTextField(12);
tf6=new JTextField(12);
tf7=new JTextField(12);
tf8=new JTestField(12);
tf9=new JTextField(12);
tf10=new JTextField(12);
tf11=new JTextField(12);
submit1 = new JButton("Submit");
submit2 = new JButton("Submit);
p1.add(l1);
p1.add(tf1);
p1.add(l2);
p1.add(tf2);
p1.add(l3);
p1.add(tf3);
p1.add(l4);
p1.add(tf4);
p1.add(l5);
p1.add(tf5);
p1.add(l6);
p1.add(tf6);
p1.add(l7);
p1.add(submit1);
p2.add(l9);
p2.add(tf7);
p2.add(l10);
p2.add(l11);
p2.add(tf8);
p2.add(l12);
p2.add(tf9);
p2.add(l13);
p2.add(tf10);
p2.add(l14);
p2.add(tf15);
p2.add(submit2);
public static void main(String args[])
{
StudentInformation student=new StudentInformation();
}
}
**** if you any clarification please comment here ,I can help you ****
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.