0

I am trying to build a sudoku puzzle with grid layout to the contentpane and adding my Cell objects(extends JPanel) to it. However, I am not able to align the components vertically centrally. Please help.

Thanks in advance.

Victor Mukherjee
  • 10,487
  • 16
  • 54
  • 97

1 Answers1

2

Set your content pane instead to use an other layout manager, e.g. GridBagLayout and add to it the GridLayout panel that holds all your Cell objects. This way your sudoku panel will be centered and its contents (the cells) will not expand to fill the whole area.

Rempelos
  • 1,220
  • 10
  • 18