aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes combo box with checkboxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "combo box with checkboxes" Watch "combo box with checkboxes" New topic
Author

combo box with checkboxes

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
Hi All,

I need a suggestion here. I have a requirement in which I have a table which has 4 categories of data. And, I have to allow multiple category selection of data. Something like, my table has -
-------------------------------
Category1
Category1Data1
Category1Data2
Category1Data3

Category2
Category2Data1
Category2Data2
Category2Data3
Category2Data4

Category3
Category3Data1
Category3Data2
-------------------------------

Now, I want to allow selection of multiple categories of data. That is, if I have a checkbox which reads "Select all category 1 data", I need to select Category1Data1, Category1Data2 and Category1Data3 in the table. If I have a checkbox which reads "Select all category 3 data" , I need to select Category3Data1 and Category3Data2 in the table.

My question is, are there better ways to do this category selection instead of having multiple checkboxes?

Also, I read somewhere that I could have a combo box with checkboxes to indicate what has to be selected. But is that right? I thought combo boxes are typically used to select one among a list of things. If I have checkboxes for each of the categories in the dropdown of combo box, would that be wrong? Would that be violating UI paradigm?


Thanks,
Preethi
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Now, I want to allow selection of multiple categories of data. That is, if I have a checkbox which reads "Select all category 1 data", I need to select Category1Data1, Category1Data2 and Category1Data3 in the table. If I have a checkbox which reads "Select all category 3 data" , I need to select Category3Data1 and Category3Data2 in the table.


I've seen this done as sub-checkboxes to a main checkbox, like in a directory tree or parent/child relationship. Select the main checkbox, and all sub-checkboxes are checked, perhaps invisibly; expand the main checkbox to show the sub-checkboxes, select/deselect some of the sub-checkboxes, and the main checkbox shows partially selected, usually indicated by graying the checkbox rather than checking it.

Also, I read somewhere that I could have a combo box with checkboxes to indicate what has to be selected. But is that right? I thought combo boxes are typically used to select one among a list of things. If I have checkboxes for each of the categories in the dropdown of combo box, would that be wrong? Would that be violating UI paradigm?


The combobox selections could be used to define the checkbox selections, as in "All Category 1," "All Category 2," etc. Then you could have a "Partial Category X" combobox item, or a shaded item to show when something less than an entire category is selected. I don't know that this would violate a UI paradigm, but it doesn't seem as intuitive as the main/sub checkbox design.

Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
 
Don't get me started about those stupid light bulbs.
 
subject: combo box with checkboxes