|
Hi
My requirement is that i hv a radio button fail.after selecting dat i hv to select the reason also using the dropdown list.if the reason is not selected an error should be thrown.how to accomplish this in java.can anyone pls help.
Thanks
|
|
|
Hi Sumu,
there are many ways you could do this, some more difficult than others. I will list a couple of ideas, but depending on how your code has been written, they might not fit in.
1) You could set the first value in the combo box to be "none", then you could obtain the value from the combo box and check that the value is not equal to "none" i.e. if(!ComboValue.compareTo("none")) //something like that.
{
}
else
{
System.out.println.........please select reason....(whatever)
}
2)The other way you could do this, would be to have a boolean global variable called "reason"(this is a bad name) set to false. When the check box is then used, inside the combobox handler set "reason" to true, then you can check the status of "reason". But remember to set it back to false again.
With both of these examples i am assuming you have a JButton that you press after the fail radio button is pressed to submit the reason. These are both very simple examples. But they will both work.
|
|
|
|
|
|
|
// |