My java code produces a label in the middle with a button on the top and bottom. I want the code below to produce something that looks like this.
I just don't know how to add 2 labels to the center with this code f.add(b2,BorderLayout.CENTER); . Because it seems like only one item can be in the center. My code wants both labels to be symmetrical that are in the center.
import java.awt.*;
import java.io.IOException;
import javax.swing.*;
public class may2 {
Frame f;
JLabel b2=new JLabel("");;
may2() throws IOException{
f=new JFrame();
JButton b1 = new JButton("First");
JButton b3 = new JButton("Second");
f.add(b1,BorderLayout.NORTH);
f.add(b2,BorderLayout.CENTER);
f.add(b3,BorderLayout.SOUTH);
f.setSize(400,500);
f.setVisible(true);
}
public static void main(String[] args) throws IOException {
new may2();
}
}
