//This method uses the newly added parameter Club object //to create a CheckBox and add it to a pane created in the constructor //Such check box needs to be linked to its handler class

Respuesta :

Comments on Question

Your questions is incomplete.

I'll provide a general answer to create a checkbox programmatically

Answer:

// Comments are used for explanatory purpose

// Function to create a checkbox programmatically

public class CreateCheckBox extends Application {

// launch the application

public void ClubObject(Stage chk)

{

// Title

chk.setTitle("CheckBox Title");

// Set Tile pane

TilePane tp = new TilePane();

// Add Labels

Label lbl = new Label("Creating a Checkbox Object");

// Create an array to hold 2 checkbox labels

String chklbl[] = { "Checkbox 1", "Checkbox 2" };

// Add checkbox labels

tp.getChildren().add(lbl);

// Add checkbox items

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

// Create checkbox object

CheckBox cbk = new CheckBox(chklbl[i]);

// add label

tp.getChildren().add(cbk);

// set IndeterMinate to true

cbk.setIndeterminate(true);

}

// create a scene to accommodate the title pane

Scene sc = new Scene(tp, 150, 200);

// set the scene

chk.setScene(sc);

chk.show();

}