Milchreis / UiBooster

🚀 Creates fast and easy dialogs for utility tools
GNU General Public License v3.0
117 stars 12 forks source link

Feature Request: Checkboxes #42

Closed KotzaBoss closed 3 years ago

KotzaBoss commented 3 years ago

It would be very helpfull to have a tickbox element out of the box for forms.

Milchreis commented 3 years ago

Good idea, but in what should it differ to this: multiple selection

KotzaBoss commented 3 years ago

Well this is a selection of tickboxes. What im refering to is isolating the tickbox as a seperate form element.

For something like this (please ignore tha names) image

What you see above is use of my attempt at a tick box. I implemented FormElement and encapsulated a JCheckBox. Consider the case for boolean values in a form like hotel booking. There are things that are boolean like hasWifi, hasTV or anything else. With the current tools the only way to simulate this is with either a slider of 0-1 or a selection of true and false which feel clunky. A tickbox is a very intuitive element for booleans to have in a form.

I can show you my interpretation of a "CheckBoxFormElement" so that you can give me some feedback!

Milchreis commented 3 years ago

Ok, I understand, for a few options it's much cleaner 👍. Please, fork the UiBooster repo and add your implemented FormElement to the src/main/java/de/milchreis/uibooster/model/formelements package. After that you can start a pull request and integrate you changes to this project. In that way it's very easy to add changes or discuss to the code.

Milchreis commented 3 years ago

The checkbox selection is integrated now. It could used as follows:

Form form = booster
                .createForm("Personal information")
                .addSelectionWithCheckboxes(
                        "Whats your favorite genres?",
                        Arrays.asList("Action", "Drama", "Comedy", "Romance", "Thriller", "Animation", "Fantasy",
                                "Adventure", "Crime", "Mystery", "Sci-fi", "Horror"))
                .show();

grafik