Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java text fields on a panel in a 2d array  RSS feed

 
Andrew Evans
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm trying to design a sudoku solver and finding it slow going. I have a front end GUI with a button panel and
a 9x9 grid. Can someone help me with trying to fill make the cells accept text. I've tried quite a few things but can't get it to work.

Here is the code that i have manged to put together

 
Rob Spoor
Sheriff
Posts: 20904
81
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change line 85 to add the control to GuiPanel, instead of to the JFrame. Then you'll see that 500x500 pixels is too small for your application. If you call pack() after line 109 you'll see that the preferred size isn't 500x500 - on my system it's 893x242.

And while you're at it, don't call setVisible(true) until you're done constructing the entire frame. Components added after the frame is shown will not automatically be visible until you resize the frame.
 
Andrew Evans
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot that now works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!