All of the code is within a class that extends JFrame and implements the actionListener
The button is aligned in the top middle of tab 2.
//The tabbed pane object is constructed
JTabbedPane tabs = new JTabbedPane();
//This creates the template for the multiple tabs using JTabbedPane
getContentPane().add(tabs);
JPanel panelAddEmployee = new JPanel();//This will create the first tab "Add Employee"
JPanel panelSearchEmployee = new JPanel();//This will create the second tab "Search for an Employee"
JPanel panelRemoveEmployee = new JPanel();//This will create the third tab "Remove an Employee"
JPanel panelSysOptions = new JPanel();//This will create the fourth tab "System options"
//This adds the first, second, third and final tab to the tabbedPanel Object
tabs.addTab("Add Employee", panelAddEmployee);
tabs.addTab("Search for an Employee", panelSearchEmployee);
tabs.addTab("Remove an Employee", panelRemoveEmployee);
tabs.addTab("System Options", panelSysOptions);
//This creates a new button called "Press" and adds it to the second tab
JButton test = new JButton("Press");
panelSearchEmployee.add(test);

New Topic/Question
Reply




MultiQuote




|