I always use the method as campfire11(营火)
for example
Container c = getContentPane();
c.setLayout(null);
JButton btn1 = new JButton("btn1");
btn1.setBounds(new Rectangle(x, y, width, height)); //you can change x, y to change the position of btn1 in window, and change width, height to change the size of btn1
c.add(btn1);