Question
I'm having a hard time creating this class. SelectPane SelectPane class should contain at least the following instance variable: Attribute name Attribute type Description clubList
I'm having a hard time creating this class.
SelectPane
SelectPane class should contain at least the following instance variable:
Attribute name | Attribute type | Description |
clubList | ArrayList | a list of club objects. |
This class should have a constructor:
public SelectPane(ArrayList clubList)
where the parameter "clubList" is passed from the Assignment6 class. The constructor layouts and organizes nodes/components in this panel. You will be adding more variables (nodes/components) than what is listed here, including check boxes, and labels. An object of some pane (maybe VBox) needs to be created, where check boxes will be added later on, and it needs to be added to this SelectPane.
} //end of SelectPane class
public void updateClubList(Club newClub)
This method creates an object of CheckBox using the toString method of the parameter object newClub. Then the check box should be added to the pane that was initially added to the SelectPane in the constructor.
This class contains a nested class called SelectionHandler class that implements EventHandler interface. Thus you need to define its handle method that is supposed to check which check boxes are checked, and compute and update the total number of members of selected clubs whenever one check box is checked or unchecked.
import javafx.scene.control.Label;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.*;
import javafx.event.ActionEvent; //**Need to import
import javafx.event.EventHandler; //**Need to import
import java.util.ArrayList;
import javafx.collections.ObservableList;
import javafx.scene.Node;
//import all other necessary javafx classes here
//----
public class SelectPane extends BorderPane
{
private ArrayList clubList;
//constructor
public SelectPane(ArrayList list)
{
//initialize instance variables
this.clubList = list;
//set up the layout
//----
//create an empty pane where you can add check boxes later
//----
//SelectPane is a BorderPane - add the components here
//----
} //end of constructor
//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
public void updateClubList(Club newClub)
{
//-------
}
//create a SelectionHandler class
private class SelectionHandler implements EventHandler
{
//Override the abstact method handle()
public void handle(ActionEvent event)
{
//When any radio button is selected or unselected
//the total number of members of selected clubs should be updated
//and displayed using a label.
}
} //end of SelectHandler class
Club Selection Apps Club Creation Club Selection X Select some clubs Club Name: Hiking Club Number Of Members: 42 University: ASU Club Name: Robotics Club Number Of Members: 28 University: UofA a Club Name: Gaming Club Number Of Members: 57 University: NAU The total number of members for the selected club(s): 99 Club Selection Apps Club Creation Club Selection X Select some clubs Club Name: Hiking Club Number Of Members: 42 University: ASU Club Name: Robotics Club Number Of Members: 28 University: UofA Club Name: Gaming Club Number Of Members: 57 University: NAU The total number of members for the selected club(s): 28 Club Selection Apps Club Creation Club Selection X Select some clubs Club Name: Hiking Club Number Of Members: 42 University: ASU Club Name: Robotics Club Number Of Members: 28 University: UofA a Club Name: Gaming Club Number Of Members: 57 University: NAU The total number of members for the selected club(s): 99 Club Selection Apps Club Creation Club Selection X Select some clubs Club Name: Hiking Club Number Of Members: 42 University: ASU Club Name: Robotics Club Number Of Members: 28 University: UofA Club Name: Gaming Club Number Of Members: 57 University: NAU The total number of members for the selected club(s): 28Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started