2 つの jPanels を JFrame に並べて追加したいと考えています。2 つのボックスは jpanels で、外側のボックスは jframe です
これらのコード行があります。JPanel を拡張する seatinPanel という 1 つのクラスがあり、このクラス内には、コンストラクターと、JPanel オブジェクトを返す utilityButtons という 1 つのメソッドがあります。utilityButtons JPanel を右側に配置します。ここにあるコードは、実行時に utilityButtons JPanel のみを表示します。
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);
}