• Post Reply Bookmark Topic Watch Topic
  • New Topic

sudoku java style  RSS feed

 
Douglas Chorpita
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am relatively new to Java.

I want to take a Sudoku Solver application that I designed in C++ and create a Java applet/application version.

I actually did this already, but the results are disappointing.

As you know, the paint method of my applet gets a Graphics object reference. I am simply painting my Sudoku rectangles and numbers using the methods of Graphics. It works, but sometimes (not all the time) the numbers don't get painted. The painting is also kind of slow.

What to do?

I have a few questions:

1. Is there a better way to design this? Using Swing buttons for each Sudoku box? Using threads?

2. How do I design this as both an application and an applet so that I can test it in my (NetBeans) IDE, but also run it in a browser?

I would be very thankful for any expert advice and design opinions.

Thank you.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I am relatively new to Java.
> so that I can test it in my (NetBeans) IDE,

these days, the two go hand-in-hand.

here's a SuDoKu solver (untested, but worth subscribing to the newsletter anyway)

http://www.javaspecialists.co.za/archive/newsletter.do?issue=128&locale=en_US

It's only a simple matter to modify for GUI input/output
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach should work in general. I used something similar to implement Sudoku in Java, and saw no need for buttons or threads.

As to how to create a combination applet/application, check out this FAQ entry. It introduces two classes that let you treat one as the other. Even if you don't end up using them directly, it should give you ideas on how to design your classes to make this possible.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!