aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Jcheckbox array with various Listener! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Jcheckbox array with various Listener!" Watch "Jcheckbox array with various Listener!" New topic
Author

Jcheckbox array with various Listener!

Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 483
I get base source code in this.
I change it as bellow

My problem is
1. i want at program start only one checkbox should enable...rest all disable
2. when 1st checkbox get 'checked'... same time 2nd checkbox should enable...rest all disable...
3. when 2nd checkbox get check...3rd will enable....but 1st will disable...
4 but now instead of checking 3rd if i remove 'checked' from 2nd...then 1st will enable...

So any time i got checkbox number n for check or uncheck...same time n-1 & n+1 both checkbox get enable...but n-2 & n+2 & rest all get disable...
I tried but stuck in code...need clue...I trying till some one reply...if i got way before reply then i will post here...


Millions saw the apple fall, but Newton asked why.
If you understand, say "understand". If you don't understand, say "don't understand". But if you understand and say "don't understand". How do I understand that you understand? Understand!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32830
    
    4
Mandar Khire wrote: . . .
I tried but stuck in code...need clue...I trying till some one reply...if i got way before reply then i will post here...
That is part of the problem. You have tried writing code before you worked out what you want to write.

Start from scratch. Draw a diagram of your array of check boxes, and how you intend to activate them. If you have an array, you can probably use the array index to activate the next box.
But that will give you a very strange design of you GUI.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the disable/enable bit sounds very similar to using a ButtonGroup,
where only one can be selected at a time (except they're all still 'enabled').

as for the 'unchecking' of a checkBox, probably one of the listeners where
you can test for 'unselected', and if so, set the appropriate checkbox to selected true.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Jcheckbox array with various Listener!
 
Similar Threads
Making radio buttons noneditable
JCheckBox problem
searching JFrame
GUI problem
ChangeListener