Java tutorial
import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Main { public static void main(String[] args) { JFrame f = new JFrame(); JPanel centeredPanel = new JPanel(); centeredPanel.add(new JButton("one")); centeredPanel.add(new JButton("two")); f.getContentPane().add(centeredPanel); f.pack(); f.setVisible(true); } }