I wish that was an option buy my Java class requires we write out the entire thing, my program is looking fine except for this one problem I seem to be facing. I will eventually figure it out, will get back to everyone when I do. After a bit of brain power and suggestions of boxes within boxes etc.
public class Layout extends JFrame{
public Layout (){
//Create 1 master panel (p1), than 2 panels that will go inside of it
JPanel p1 = new JPanel(new BorderLayout());
JPanel p2 = new JPanel(new GridLayout(1,5));
JPanel p3 = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel p4 = new JPanel(new FlowLayout(FlowLayout.CENTER));
//Setting up font for centering
//Populating the grid with buttons
JButton jbtAdd = new JButton("Add Employee");
JButton jbtChange = new JButton("Change Employee");
JButton jbtClear = new JButton("Clear Fields");
JButton jbtRead = new JButton("Read File");
JButton jbtWrite = new JButton("Write File");
p2.add(jbtAdd);
p2.add(jbtChange);
p2.add(jbtClear);
p2.add(jbtRead);
p2.add(jbtWrite);
//Created textfields and labels
JTextField jtxtFN = new JTextField("", 10);
JTextField jtxtLN = new JTextField("", 10);
JTextField jtxtWage = new JTextField("", 8);
JTextField jtxtEmp = new JTextField("", 5);
JLabel jlFN = new JLabel("First Name");
JLabel jlLN = new JLabel("Last Name");
JLabel jlWage = new JLabel("Wage");
JLabel jlJob = new JLabel("Job Type");
JLabel jlEmp = new JLabel("Employee ID");
JLabel jlGend = new JLabel("Gender");
//Center All Labels:
jlFN.setHorizontalAlignment(JLabel.CENTER);
jlLN.setHorizontalAlignment(JLabel.CENTER);
jlWage.setHorizontalAlignment(JLabel.CENTER);
jlJob.setHorizontalAlignment(JLabel.CENTER);
jlEmp.setHorizontalAlignment(JLabel.CENTER);
jlGend.setHorizontalAlignment(JLabel.CENTER);
//Laying out the text boxes with labels to center
JPanel f1 = new JPanel(new GridLayout(2,1));
JPanel f2 = new JPanel(new GridLayout(2,1));
JPanel f3 = new JPanel(new GridLayout(2,1));
JPanel f4 = new JPanel(new GridLayout(2,1));
JPanel f5 = new JPanel(new GridLayout(2,1));
JPanel f6 = new JPanel(new GridLayout(2,1));
JPanel f7 = new JPanel(new GridLayout(1,3));
f1.add(jlFN);
f1.add(jtxtFN);
f2.add(jlLN);
f2.add(jtxtLN);
f3.add(jlWage);
f3.add(jtxtWage);
p3.add(f1);
p3.add(f2);
p3.add(f3);
//Combo Box with proper labeling
f4.add(jlJob);
JComboBox jcJob = new JComboBox();
jcJob.addItem("Hourly");
jcJob.addItem("Salaried");
jcJob.addItem("Consultant");
f4.add(jcJob);
p3.add(f4);
f5.add(jlEmp);
f5.add(jtxtEmp);
p3.add(f5);
f6.add(jlGend);
//Radio Buttons with Button group
JRadioButton jbMale = new JRadioButton("Male");
JRadioButton jbFemale = new JRadioButton("Female");
JRadioButton jbUnkown = new JRadioButton("Unknown");
ButtonGroup bg = new ButtonGroup();
bg.add(jbMale);
bg.add(jbFemale);
bg.add(jbUnkown);
f7.add(jbMale);
f7.add(jbFemale);
f7.add(jbUnkown);
f6.add(f7);
p3.add(f6);
//Creating the list
JLabel jlEmpList = new JLabel("Employee List");
JList jlList = new JList();
p4.add(jlEmpList);
p4.add(jlList);
add(p4, BorderLayout.WEST);
add(p2, BorderLayout.SOUTH);
add(p3, BorderLayout.CENTER);
}
After Scouring the internets I've found everything I've needed to make my GUI! Now its time to learn how to use handling!