SnTT: Java Method for building a checkbox dialog
Like I said earlier, I've been messing with Java more and more here lately, mainly to build graphs using JFree Chart. In just about every statistics report I'm doing I provide a checkbox for the user to select what data they want to display. So, I've built a Java Method/Function whatever you want to call it, that will simplify the task of putting a JCheckboxes in a JPanel with an instruction label and footer text with OK and Cancel buttons (See Screenshot).

The idea here is to build an array of strings, determine a window title, label text and if needed footer text and pass that to the method which will then loop through the array and build the JPanel according to the information you pass. you can see the example here. The constCheckBox method will then spit out a dialog which should look something like the one above. One of the stipulations of this thing is that the "chkBoxes" variable (from the sample code) has to be declared as a global variable something like "JCheckBox chkBoxes[];" above the notes main section.
OK, so I can't post the code
, it's too big to post all the HTML for the formatting and stuff
. So, it's available over in the downloads section
So hopefully this will be of use to someone other than myself. I know I didn't go into much explanation of the actual code I think I mainly posted it as a reference to myself to see how to do this sort of thing in the future as I imagine this kind of functionality is used quite often. I kinda like this Java stuff, it's starting to make more sense
.










