Here is my program, its like a 3 number hi-low game.
I am using for the top, middle, and bottom rows. Then inside those panels I use gridlayout to layout the objects. I want to know if instead of them being in their respective grids on the left hand side, if they could be centered inside of their grid?
I tried using setAlignmentX and that didn't work. I don't really know how to go about it. I'll post a snippet of my code that is important.
//middle panel setup JPanel middle = new JPanel(); middle.setLayout(new GridLayout(1, 3)); higher = new JButton("Higher"); higher.setAlignmentX(CENTER_ALIGNMENT); middle.add(higher); or = new JLabel("OR"); or.setAlignmentX(CENTER_ALIGNMENT); middle.add(or); lower = new JButton("Lower"); lower.setAlignmentX(CENTER_ALIGNMENT); middle.add(lower); pane.add(middle);
EDIT: I drew what I want it to be like in paint...