• Post Reply Bookmark Topic Watch Topic
  • New Topic

To mark all Checkboxes?

 
Gabriela Eriksson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone.
I have a little problem here. Working on a page with a whole lot of checkboxes. I now want to make another checkbox on the top that by marking will mark all other checkboxes as checked. I knew this once but have forgotten the syntax. Can anyone help me out here?
By the way...we don't use swing here and they have Java 1.2..*sob*
Thx Gab
[This message has been edited by Gabriela Eriksson (edited April 04, 2001).]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gab,
Let's say you have one checkbox called selectAll and a vector of checkboxes called checkVect... here's a short snippet of the code you would use...

HTH,
-Nate
 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan,
My requirement is similar to this one.I want one more functionality in this.I want selectAll to expand....showing all the options like in a tree structure and hide options.So that just the main checkboxes are visible and all corresponding options are hidden.Only if we want to deselect a few options should we need to expand the selectAll.
Is it confusing???I hope not.
Any solution for this would help.
Thanks
Pomchi
 
Gabriela Eriksson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nathan!
I will as soon as possible try to implement your surgestion to solution in my code. Will let u know if it works.
Have an other little question..*blushing*. Do u know how i could make a counter after every checkbox?. I was thinking here and came to the conclution that i need one on every row and after every checkbox.
Gab
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pomchi,
Sorry, I am a bit confused on exactly what you want the GUI to do...
Do you want, let's say, a button, that brings up a new dialog that will let you select which checkboxes show up on the main window? This dialog will have all checkboxes that could possibly show up on the main window and you can turn them on or off possibly by using checkboxes or a JTree ( Sorry, I haven't used JTree alot... ) Is this what you want?
I just wanted to make sure I got the specification right before I started coding....
-Nate
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gab,
What do you mean by a counter? Do you mean something that counts each time the checkbox is selected? Does this counter count every time the checkbox is chosen, or only for the current session? And when you say you need one on every row and for every checkbox, what do you mean by every row? What determines what row something is in? Just the GUI, or is there something else that determines what is in a row? Does the counter for the row just contain the sum of the counters for each checkbox? Could you give me a little background on what exactly you are wanting this to do?
-Nate
 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan,
In my project I have a few groups/packages and each group contains a few features.I want a tree like structure in
which groups would be parents and features would be leaves....and when I select a parent node(group) all the
corresponding leaves should get selected.In this way I will be able to select features gropwise just by a few clicks and I
will also be able to deselect the featues that I do not want.
So basically I want a tree structure in which my nodes would be checkboxes.Now my question is how can I add checkboxes to the nodes.
Hope now my question is a bit clear.
Any suggestion would help.I am also new to Java and tree.
Thanks
Pomchi
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pomchi,
Sorry, I really don't know enough about JTree to help much... Maybe someone else here knows how to do this?
-Nate
 
Pomchi Bedi
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nate,
Thanks for responding to my post.But I got the solution for my problem.Check it out.

Thanks
Pomchi

[This message has been edited by Pomchi Bedi (edited April 06, 2001).]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pomchi:
could you pl. edit your earlier post and use the [ code ]
opening and closing tags without the space, so your source
code is indented.
Thanks for your cooperation.
- satya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!