Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: grouping jcheck button's

  1. #1
    Member
    Join Date
    Oct 2012
    Posts
    133
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default grouping jcheck button's

    public class j_01_FLOW_06 extends JApplet implements ActionListener
    {
    	//Choice shoplist = new Choice();
    	//ButtonGroup bg_group = new ButtonGroup();
     
    	CheckboxGroup cg_Group = new CheckboxGroup();
    	JCheckBox cb_i1 = new JCheckBox("fafa");
    	JCheckBox cb_2 = new JCheckBox("wfw");
    	JCheckBox cb_3 = new JCheckBox("Computer");
     
    	String s_value[]={"white sox","red sox","mets","cordianls","blue jays"};
    	JList l_list = new JList(s_value);
     
    	Container c;
    	FlowLayout flow = new FlowLayout();
     
     
    	public void init()
    	{
    		c = getContentPane();
    		c.setLayout(flow);
     
     
    		cb_group.add(cb_1);
                    cb_group.add(cb_2);
                    cb_group.add(cb_3);
                   c.add(cb_group);
    		c.add(shoplist);
     
               }
    }


    i want to group some jcheck buttons. so that its top to bottom. but iam getting error at :
    cb_group.add(cb_1);
    cb_group.add(cb_2);
    cb_group.add(cb_3);
    c.add(cb_group);


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: grouping jcheck button's

    i want to group some jcheck buttons. so that its top to bottom. but iam getting error at :
    What is the error?

  3. #3
    Member
    Join Date
    Oct 2012
    Posts
    133
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default Re: grouping jcheck button's

    undifne method

    add(cb_1)

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: grouping jcheck button's

    JCheckBox cb_i1 = new JCheckBox("fafa");

    ?

  5. #5
    Member
    Join Date
    Oct 2012
    Posts
    133
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default Re: grouping jcheck button's

    JCheckBox cb_i1 = new JCheckBox("fafa");

    ?
    ... yes that line work fine. problem is with checkboxgroup.

  6. #6
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: grouping jcheck button's

    JCheckBox ------ cb_i1 ------ = new JCheckBox("fafa");
    add(cb_1)

    are you sure?

Similar Threads

  1. Challenging Java Question: Test your Java skill by grouping these terms
    By karthickk3 in forum Java Theory & Questions
    Replies: 3
    Last Post: July 18th, 2012, 10:10 PM
  2. Can't use button.addActionListener(this); ?
    By xdega in forum AWT / Java Swing
    Replies: 2
    Last Post: April 23rd, 2012, 08:44 AM
  3. Reset button.
    By ish in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 17th, 2011, 07:57 AM
  4. button positioning
    By pds8475 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 29th, 2011, 09:35 AM
  5. Please help with Actionlistener-Button
    By ashleykathy in forum AWT / Java Swing
    Replies: 1
    Last Post: March 4th, 2010, 08:21 PM