the problem is done
Printable View
the problem is done
1) Use your radio button results and if blocks to create Strings:
2) To make your code more easily read in the forum, use spaces, not tabs for indentation. Three to four spaces usually works nicely.Code:if (myRadio.isSelected()) {
someString += "Fubars, ";
}
3) To help forum members know what your thread is about at a glance, please use a more informative thread title. "Need Help" doesn't say much as most all threads are posted because the OP needs help.
Much luck and hope this helps!
For me what you are asking is not clear enough. And also as Fubarable says, your thread title is not appropriate. Better to use a meaningful title next time.
Again, have you tried my suggestion number 1 above?
You're creating a humongous String called string1 (you will want to choose better more descriptive names for your variables as it will make your code much easier to understand), that is holding the summary of all the rental information, and presently you are trying to get information from some JRadioButtons like so:
Code:+ "\nOptional : " + gps.isSelected() + insurance.isSelected()
Since isSelected returns either true or false, there should be no surprise that this will result in an output that will look something like:
Code:Optional: truefalse
Instead I'd create several smaller Strings, one for each set of radiobuttons, for instance one called optionsString that summarizes the results found in the options collection of radio buttons, and do this before creating your humongous string1. It could look something like so:
Code:String optionsString = "Options: ";
if (gps.isSelected()) {
optionsString += "GPS ";
}
// may need an else here if this group of JRadioButtons use a ButtonGroup
// and selecting one exludes selecting another
if (insurance.isSelected()) {
optionsString += "Insurance ";
}
And then when you create your humongus string1 (which might be better called rentalSummaryString)
where you have this:
Code:+ "\nOptional : " + gps.isSelected() + insurance.isSelected()
instead have this:
Note that none of my code has been tested or debuggedCode:+ "\n" + optionsString
Much luck, and hope this helps