Solved

ButtonGroup question..

Posted on 2002-04-15
3
277 Views
Last Modified: 2010-08-05
I have 5 x 5 radio button, the columns are in a button group, is it possible to have the columns in another button group where each button is a member of two groups?

ppl
A   1   2   3   4   5

B   1   2   3   4   5

C   1   2   3   4   5

D   1   2   3   4   5

E   1   2   3   4   5

In simple terms, no two rows (people A -> e) can have the same column value.
0
Comment
Question by:decob
3 Comments
 

Expert Comment

by:megloff
ID: 6943144
Hi
Are you using AWT? With AWT is this not possible, in this case you must implement listener and to code the behavior by yourself.
I think Swing is here more powerful. Have a look at java.swing.JRadiobutton and java.swing.ButtonGroup. You can add JButton's to the ButtonGroup. All JButtons in a ButtonGroup build an own Column. So theoretical, you can add a JButton to two different Groups, but I have never tried this.  

Hope this helps.

Regards
Mark

   
0
 
LVL 2

Accepted Solution

by:
mzimmer74 earned 100 total points
ID: 6943185
Well, I tried that, but if you put the same component in two different groups things don't work that well.  I made a 3x3 grid but clicking in any of the radio buttons caused any that was on to turn off even if it couldn't be in the same group.  So in short, the answer is no, you can't do it directly.  However, as with any component you could probably create your own special object that could handle this.  Not sure what it would be off the top of my head though.
0
 
LVL 92

Expert Comment

by:objects
ID: 6943395
Why not have 5 button groups, one for each column?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 2 42
groupSum6 challenge 6 35
mapShare challenge 13 68
firstChar challenge 13 84
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now