X

Geertjan's Blog

  • June 12, 2010

Mona Lisa Puzzle (Part 3)

Geertjan Wielenga
Product Manager
The next step in the Mona Lisa puzzle is to let the user set the image that should form the basis of the puzzle. Via a button in the global toolbar, this wizard is displayed:

There's a complete Wizard framework that is part of the NetBeans Platform. It really lets you focus on your domain logic, without needing to think too much about the logic needed for the wizard to work. So, in the above case, I used the Wizard wizard in NetBeans IDE to create a wizard skeleton, added my UI components in the Matisse GUI Builder, and then specified the values that needed to be stored, using the placeholders in the generated code to do so. Everything else, such as the buttons you see above, come for free with the Wizard framework, so that you don't need to create them yourself. You can also add validation logic to the skeleton created by the Wizard wizard, to prevent the user from completing the wizard if the values have not been set or have not been set correctly.

Then the NbPreferences API is used to store the values set above, with a PreferenceChangeListener in the PuzzleScene class, causing the scene to be recreated when the user changes the values in the Puzzle Wizard, since doing so causes the preferences to change:

Everything mentioned above is documented and described in the NetBeans Wizard Module Tutorial.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.