• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to check all check boxes at a click of a button

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Swing, UI and MVC
I have created a code based on MVC. Now my problem is that that in the controller part i have an actioneventlistener which listens to different button clicks. Out of all those buttons i have "select all" and "de-select all". In my view i have a table, one of the column of that table contains "check boxes". Now, when i click the "select-all" button i want to check all the check boxes and with "de-select all" i want to uncheck all of them.

Below is my code which is not working. Please tell me what am i doing wrong here. Also, if someone knows a more elagent way please share. Thanks

In my view

Table Model


A Views Action Listener



Main Controller

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem solving 101:

create a single column table to display checkBoxes (text optional)
add another button to the frame to "select-all"
add your attempt to the button's listener, and if it doesn't work,
you have a very small program to post here - one that has no
dependant classes we don't have.
 
Muhammad Salman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Dunn wrote:problem solving 101:

create a single column table to display checkBoxes (text optional)
add another button to the frame to "select-all"
add your attempt to the button's listener, and if it doesn't work,
you have a very small program to post here - one that has no
dependant classes we don't have.



Ya, i understand the program looks quite huge but i have pasted it just for the sake of completeness and the problem i am facing has nothing to do with the whole code i have pasted. I will draw directions to where my program flows and where it does not do where i expect it do something.

So starting from :
1, CustomerSelectorUIListener, the actionEvent.equals( "selectAllButton" ) trigers controller.checkButtonControl(true)
2, In the Controller i have checkButtonControl (Boolean checkAll) which calls selectUI.PopulateAndShow(store, checkAll)

Now, in my View, CustomerSelectorDialogUI class a PopulateAndShow function is called and here things go wrong. So, this function looks something like. Please see the comment in the code (after the tModel= new TableModel(data))


 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Crossposted
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, another added to personal ignore list.
 
Muhammad Salman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michael Dunn wrote:Thanks, another added to personal ignore list.



Ya, ya this is also a no-go area for you :P

Bytheway, whats so wrong with cross posting. If you guys here gurantee me results then i wouldnt cross post. DO YOU / CAN YOU ??
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muhammad Salman wrote:

Michael Dunn wrote:Thanks, another added to personal ignore list.



Ya, ya this is also a no-go area for you :P

Bytheway, whats so wrong with cross posting. If you guys here gurantee me results then i wouldnt cross post. DO YOU / CAN YOU ??



Please KeepItDown
You can refer to https://coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites to understand what we expect when you cross post.
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic