import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; public class SecondGUI extends JFrame { public static void main(String[] args) { // new SecondGUI().setVisible(true); new SecondGUI(); } public SecondGUI(){ super("SecondGUI"); getContentPane().setLayout(new FlowLayout()); getContentPane().add(new JButton("B1")); getContentPane().add(new JButton("B2")); getContentPane().add(new JButton("B3")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } }