• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jcheckbox array with various Listener!  RSS feed

 
Mandar Khire
Ranch Hand
Posts: 573
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!