JButton button1 = new JButton(\"Button 1\");
JButton button2 = new JButton(\"Button 2\");
JFrame frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout(
You can add a jPanel and then add the two buttons to it, and then call setBounds on the buttons and specify the position. Then add the jPanel to the jFrame.
JButton button1 = new JButton("Button 1");
JButton button2 = new JButton("Button 2");
JFrame frame = new JFrame();
JPanel p = new JPanel();
p.setLayout(null);
button1.setBounds(10, 400, 100, 40);
p.add(button1);
button2.setBounds(375, 400, 100, 40);
p.add(button2);
frame.getContentPane().add(p);
frame.setSize(500, 500);
frame.setVisible(true);
The bounds are set as (x-coord, y-coord, width, height).