I’m making a Sudoku program in java to learn some algorithms so I want the user to be able to input an unsolved Sudoku puzzle. Here is what I have so far that creates 81 (9×9) boxes:
JTextField input[] = new JTextField[80];
for(int i = 0; i <= 79; i++)
{
input[i] = new JTextField();
input[i].setPreferredSize(new Dimension(30,30));
f.getContentPane().add(input[i]);
}
When I run this program though all I get is just one input field. I know that all the text fields and initialized, created and added to the jframe. I know you have to mess this the layout but I’m not sure how to do that. Any help is appropriated.
Use a
JPanelwithGridLayout.Also:
That’s 80 (not 81) text fields.
Update: (sample code)