This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Help with radio button action depending of another radio button in another group Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help with radio button action depending of another radio button in another group" Watch "Help with radio button action depending of another radio button in another group" New topic
Author

Help with radio button action depending of another radio button in another group

Tavo Gtz
Greenhorn

Joined: Mar 29, 2013
Posts: 8
Hey guys, I´m new to this forum and new to java, so I´m actually not really good at using neither. This is my first post and I understand that these type of forums have rules, so if I break any, or I can do something in a better way, please let me know.

I have an issue with a current school assignment. Basically, I have to build a calculator that will be able to convert binary to decimal, binary to octal, binary to hexadecimal, and so on, using the option to convert from whatever numeric system you want to the one you prefer.

The way Im trying to do this, is by having two radio button groups, one to choose which type of number you want to type in through buttons and the other group to select the numeric system you want to convert to.

Right now I have:

RadioButtonGroup 1:
*Binary
*Octal
*Decimal
*Hexadecimal


and

RadioButtonGroup 2:
*Binary
*Octal
*Decimal
*Hexadecimal

My issue is, that I want for a radio button in group 2 to be disabled when I choose the same option if group 1 and to enable once again if I were to change the radio button selected in group 1, but I dont know how to do this, please help. All comments towards trying to help me are appreciated.

For example, if in group 1 I choose binary radio button, I want that in group 2, binary to become disabled, but if I change the option in group 1 to octal, I want binary to be enabled once again in group 2 and disable octal radio button.

How can I do this? Any example code or example is highly appreciated
Bharvi Dixit
Greenhorn

Joined: Feb 14, 2013
Posts: 20
Hi Tavo,

I have got the solution, but i am not sure it is optimized way to do or not..
here is the sample code which might help you..




Tavo Gtz
Greenhorn

Joined: Mar 29, 2013
Posts: 8
Yes, it helped quite a lot actually. You gave me a great idea to resolve it, and now its done. Thank you so much. Is there anyway that I can mark this question as resolved? oh, and by the way, what program are you using to generate your java code?
Bharvi Dixit
Greenhorn

Joined: Feb 14, 2013
Posts: 20
My Pleasure
I use WindowBuilder in eclipse IDE.
 
wood burning stoves
 
subject: Help with radio button action depending of another radio button in another group