Как открыть новое окно, нажав на кнопку, и как мне переместить кнопку между центром на север.
import javax.swing.*;
import java.awt.*;
public class main {
private JFrame f;
private JPanel p;
private JButton b1;
public main()
{
gui();
}
public void gui() {
f = new JFrame("creativity tuts");
f.setVisible(true);
f.setSize(350,550);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
p = new JPanel();
p.setBackground(Color.yellow);
b1 = new JButton("Create Contact");
p.add(b1);
f.add(p);
}
public static void main(String[] args) {
new main();
}
}