• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java text fields on a panel in a 2d array

 
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

 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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.
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic