Hosted By

Subscribe to keithstric.com

Misc Links

Domino 7 OpenNTF BlogSphere CoComment Custom Button

Lotus Notes Blog Search

OpenNTF

Disclaimer

The opinions and ideas posted on keithstric.com are not necessarily the opinions and ideas of my employer. The solutions, techniques and code provided here are not guaranteed or warranted in any way and are free for you to use at your own risk.

« Kenny Chesney Concert | Main| IBM Joins OpenOffice.org Community »

SnTT: Java Method for building a checkbox dialog

Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

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).

constCheckBox-Java.jpg

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 .

Keith

Post A Comment

:-D:-o:-p:-(:-):-\:-|:angry::cool::cry::dontknow::emb::hairout::laugh::rolleyes::whew:;-)