I am trying to create components and implement them into my JFrame from different classes within my program.
I have created a JTabbedPane, and each tab represents a class. All of the components for each tab are placed in their respective tabs.
//creates the JTabbedPane, and the panels. object creation.
//panelx corisponds to the tab number as well. tabbs are counted from left to right.
tabpane1 = new JTabbedPane();
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
JPanel panel4 = new JPanel();
JPanel panel5 = new JPanel();
JPanel panel6 = new JPanel();
JLabel searchlabel1 = new JLabel("hey");
JLabel searchlabel2 = new JLabel("hi");
panel1.add(searchlabel1);
panel1.add(searchlabel2);
//SearchFlight searchflightComp = new SearchFlight();
tabpane1.addTab("Search Flight", panel1);
tabpane1.addTab("Select Flight", panel2);
tabpane1.addTab("Flight Price", new JLabel("This is tab 1ffff"));
tabpane1.addTab("Book Ticket", new JLabel("This is tab 1fff"));
tabpane1.addTab("Book Ticket", new JLabel("This is tab fs1"));
tabpane1.addTab("Payment", new JLabel("This is tabgf 1"));
tabpane1.addTab("Booking Summary", new JLabel("This is tabgf 1"));
//added the JTabbedPane to JFrame.
frame.getContentPane().add(tabpane1);
this works. I am only really working with the first tab right now to get the feel for how it works ect. But I dont even know how to begin. Would I create the a panel in the other class and then return it? or extend the JFrame?
thanks guys!