Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Muhammad Salman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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
  • 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))


 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crossposted
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, another added to personal ignore list.
 
Muhammad Salman
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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 ??
 
Maneesh Godbole
Saloon Keeper
Posts: 11196
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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://www.coderanch.com/how-to/java/BeForthrightWhenCrossPostingToOtherSites to understand what we expect when you cross post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic