Radio button validation
Hey I searched the forum and the net and can't seem to find any information on how I make it so if the user doesn't select a radio button it will display a message.
if (?????) //I just dont know what to put here
JOptionPane.showMessageDialog(null, "Please select a button")
Is it a group of buttons, and one has to be selected?
ie a ButtonGroup?
Then see which button is selected...it'll return null if nothing is.
I tried it like
if(bgrp1.getSelection() = null)
but it wouldn't work
And what does "it wouldn't work" mean?
So I think I have to use a variable instead of null or do it a different way, but I don't know what variable I would put there just an int with a value of 0? I'll try it and get back to you.
Looking at the bit you gave a couple of posts ago...
It's ==, not =.