Я хочу добавить две панели jPanel к JFrame бок о бок. два блока - это jpanel, а внешнее - jframe
У меня есть эти строки кода. У меня есть один класс под названием seatinPanel, который расширяет JPanel, и внутри этого класса у меня есть конструктор и один метод под названием utilityButtons, который возвращает объект JPanel. Я хочу, чтобы утилита Buttons JPanel была справа. код, который у меня здесь, отображает только JPanel utillityButtons при его запуске.
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);
}