Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

adding a grid of text fields to a JPanel

807603Nov 26 2007 — edited Nov 26 2007
hey guys,

Basically I want to make a JPanel, and fill it with a 9x9 grid of text fields.

This is what I'm doing:
// make 9x9 array of text fields
JTextField[][] board = new JtextField[9][9];

// make individual fields?
for(int i = 0; i < 9; ++i)
	for int j = 0; j < 9; ++j)
		board[i][j] = new JtextField(2); 

// make new JPanel
JPanel numberPanel = new JPanel();
numberPanel.setLayout(new GridLayout(9,9)); 
I'm confused as to how to actually get the array of text fields into the panel. Is there a logical way to do this? Am I overlooking something?

Thanks very much in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2007
Added on Nov 26 2007
1 comment
270 views