こんなふうにBorderLayoutとFlowLayoutを組み合わせたりできます。
でもコードだけでどうこうするよりswing designerを使うほうがいいかも?
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
public class BorderLayoutTest2 extends JFrame{
public static void main(String[] args){
BorderLayoutTest2 frame = new BorderLayoutTest2();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(10, 10, 300, 200);
frame.setTitle("Practice");
frame.setVisible(true);
}
BorderLayoutTest2(){
JButton button1 = new JButton("NORTH");
JButton button2 = new JButton("CENTER");
JButton button3 = new JButton("SOUTH");
JButton button4 = new JButton("WEST");
JButton button5 = new JButton("EAST");
JButton button6 = new JButton("NEW");
JButton button7 = new JButton("NEW");
JPanel p1 = new JPanel();
p1.setLayout(new BorderLayout());
p1.add(button1, BorderLayout.NORTH);
p1.add(button2, BorderLayout.CENTER);
p1.add(button3, BorderLayout.SOUTH);
p1.add(button4, BorderLayout.WEST);
p1.add(button5, BorderLayout.EAST);
JPanel p2 = new JPanel();
FlowLayout flayout = new FlowLayout();
flayout.setAlignment(FlowLayout.LEFT);
p2.setLayout(flayout);
p2.add(button6);
p2.add(button7);
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
}
}