Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 2:22 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: selection of checkbox in buttongroup in netbeans
PostPosted: Thu Jul 30, 2009 4:46 pm 
Offline
Newbie
User avatar

Joined: Wed Jul 15, 2009 8:39 am
Posts: 21
Has thanked: 0 time
Have thanks: 0 time

Hi everybody

I have created a set of checkbox that i set the property "buttongroup" the same for all (i created a buttongroup) .I work with netbeans 6.5.1 so i used the palette to make this.
I want to get the string of the selected checkbox .
the problem that i cant't access to initcomponents () the method where the components are instancied.
If i used :
Code:
buttonGroup1.getSelection().getClass().getName()

I get errors

How i can get the selected item.
Please i need a help :beg: :beg: :beg:


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: selection of checkbox in buttongroup in netbeans
PostPosted: Fri Jul 31, 2009 1:03 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 57 time
you can use :
Code:
buttonGroup.getSelection().getSelectedObjects()


or another way of thinking is :
Code:
orderButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        String entree = buttonGroup.getSelection().getActionCommand();
        System.out.println(entree + " sandwich");
        Component[] components = condimentsPanel.getComponents();
        for (Component c : components) {
          JCheckBox cb = (JCheckBox) c;
          if (cb.isSelected())
            System.out.println("With " + cb.getText());
        }
      }
    });

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 i am using NetBeans 7.0, HELP NEEDED - URGENT  General Discussion  Anonymous  0
 validate age entered as selection box in javascript  JavaScript examples  msi_333  0
 information about netbeans IDE  Servlets / JSP  rinasharma  1
 fill selection options from list  ASP/ASP.net examples  msi_333  0
 redirect page based on user selection radio button  ASP/ASP.net examples  msi_333  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 4 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team