Multiple CheckboxGroups?

Hello,

1)

I am new to this and I have maybe a stupid question.

I am now able to use Checkbox and CheckboxGroup, but I will like to have on my screen 2 CheckboxGroups , is this possible in the same class?

I wass able to do it with to classes but I will like to do it in one.

2)

Is it possible to give the first and second CheckboxGroup some start and end points ?

For example with setBounds(200,0,15,200) ?

If some people have a idea ?

Thank you and Best Regards,

Didier.

Here you have the code of one CheckboxGroup :

import java.applet.*;

import java.awt.*;

import java.awt.event.*;

public class Parametre extends Applet{

public TextField t;

public void init()

{

t = new TextField("Test",40);

add(t);

setLayout(new GridLayout(9,1));

FUNCTION();

}

public void FUNCTION()

{

t.setText("Hello");

CheckboxGroup Function = new CheckboxGroup();

add(new Checkbox("1 BYTE Scene", Function, true));

add(new Checkbox("1 BIT Confort", Function, false));

add(new Checkbox("1 BIT ON=GO / OFF=STOP", Function, false));

add(new Checkbox("1 BIT ON=STEP-UP / OFF=STEP-DOWN", Function, false));

add(new Checkbox("1 BIT Togle ON/OFF/ON", Function, false));

add(new Checkbox("4 BIT Dimmer STEP-UP / STEP-DOWN", Function, false));

add(new Checkbox("1 BIT Curtain SHORT STEP-UP / SHORT STEP-DOWN", Function, false));

add(new Checkbox("1 BIT Curtain SHORT << / SHORT >>", Function, false));

add(new Checkbox("1 BIT Curtain LONG << / LONG >>", Function, false));

}

}

[1707 byte] By [DRI1966] at [2007-9-27 14:49:45]
# 1

Sure, why not?

public void init(){

/** Constructing the different Checkboxes and storing the references

* in different arrays.

*/

Checkbox[] firstBoxes = {new Checkbox("A text"),

new Checkbox("Another text")};

Checkbox[] firstBoxes = {new Checkbox("An option"),

new Checkbox("Another option")};

Checkbox[] firstBoxes = {new Checkbox("This is a"),

new Checkbox("test")};

//Take a look in the documentation for a description of layoutmanagers

setLayout(new GridLayout(3,1));

//Each call to createCheckboxGroup returns a JComponent which is

//added to the applet.

add(createCheckboxGroup(firstBoxes));

add(createCheckboxGroup(secondBoxes));

add(createCheckboxGroup(thirdBoxes));

}

public JComponent createCheckboxGroup(Checkbox[] boxes){

CheckboxGroup group = new CheckboxGroup();

boxes[0].setSelected(true);

for(int i=0; i<boxes.length; i++){

group.add(boxes[i]);

}

}

I hope you got the idea.>

DOMO at 2007-7-5 22:49:49 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
Thank you for your quick reply,I will test it.Best Regards,Didier.
DRI1966 at 2007-7-5 22:49:49 > top of Java-index,Archived Forums,New To Java Technology Archive...