If you want to set the exact location and size of a component use the following code:
//imports
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Component;
//code
JPanel pnl = new JPanel();
pnl.setLayout(null);
JButton btn = new JButton();
//sets the size and location of a component
//[component].setBounds(int x, int y, int width, int height);
btn.setBounds(50, 50, 100, 30);
pnl.add(btn);
add(pnl);
Very helpful if you want absolute control.