This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Is there any easy way to vertically center buttons in a panel? I am trying to display a column of buttons at a size of 60x60 pixels for each button. The code below does everything except the centering fine -- but of course if I add the buttons to the CENTER of the panel, they get stretched.
I guess I could use an empty border around the panel, and calculate its size by subtracting the size of the buttons from the height of the window etc, but is there an easier way?
Thank you!
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
change this JPanel subPanel = new JPanel(new BorderLayout()); subPanel.add(buttonPanel, BorderLayout.SOUTH);