What i want is my timer buttons to be on the bottom with minimal space for them, i dont want them to take half of the frame, but i dont know how to resize the panel within the frame. Help would be appreciated and if someone could proof read it too that would be nice.
import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; public class SudokuPanel extends JFrame { public final int SQUARE_COUNT = 9; public Squares [] squares = new Squares[SQUARE_COUNT]; public SudokuPanel(){ super("Sudoku"); setSize(600,600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridLayout(2,1)); JPanel panel = new JPanel(new GridLayout(3,3)); for(int i=0; i<SQUARE_COUNT; i++){ squares[i] = new Squares(); panel.add(squares[i]); } JPanel panel2 = new JPanel(); JButton start = new JButton(); JButton stop = new JButton(); start = new JButton("Start Timer"); stop = new JButton("Stop Timer"); panel2.add(start); panel2.add(stop); add(panel); add(panel2); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu menu = new JMenu("Menu"); menuBar.add(menu); JMenuItem newDifficulty = new JMenuItem("Select New Difficulty"); menu.add(newDifficulty); JMenuItem reset = new JMenuItem("Reset"); menu.add(reset); JMenuItem exit = new JMenuItem("Exit"); menu.add(exit); class newDifficultyaction implements ActionListener{ public void actionPerformed (ActionEvent e){ dispose(); Level select = new Level(); } } class exitaction implements ActionListener{ public void actionPerformed (ActionEvent e){ System.exit(0); } } newDifficulty.addActionListener(new newDifficultyaction()); exit.addActionListener(new exitaction()); setVisible(true); setLocationRelativeTo(null); } }