KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to add two jPanels to a JFrame side by side. the two boxes are jpanels and the outer box is a jframe I have these lines of code. I have one class called seatinPanel that extends JPanel and inside this class I have a constructor and one method called utilityButtons that return a JPanel object. I want the utilityButtons JPanel to be on the right side. the code I have here only displays the utillityButtons JPanel when it runs. public guiCreator() { setTitle("Passenger Seats"); //setSize(500, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = getContentPane(); seatingPanel seatingPanel1 = new seatingPanel();//need to declare it here separately so we can add the utilityButtons contentPane.add(seatingPanel1); //adding the seats contentPane.add(seatingPanel1.utilityButtons());//adding the utility buttons pack();//Causes this Window to be sized to fit the preferred size and layouts of its subcomponents setVisible(true); }
Tags (comma-separated)
Save Edits
Cancel