$30
CSE205 - Assignment #6
Make sure that you write every line of your code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report to the Dean's office.
Go to "GradeScope" tab on Canvas - Assignment6, and upload your files.
Minimal Submitted Files
You are required, but not limited, to turn in the following source file:
Assignment6.java (https://canvas.asu.edu/courses/44324/files/12606222/download?wrap=1)
(https://canvas.asu.edu/courses/44324/files/12606222/download?wrap=1) (Download this file and use it as your driver program for this assignment.)
CreatePane.java (https://canvas.asu.edu/courses/44324/files/12606225/download?wrap=1)
(https://canvas.asu.edu/courses/44324/files/12606225/download?wrap=1) (Download this file. You need to add more code to complete it.)
SelectPane.java (https://canvas.asu.edu/courses/44324/files/12606226/download?wrap=1)
(https://canvas.asu.edu/courses/44324/files/12606226/download?wrap=1) (Download this file. You need to add more code to complete it.)
Club.java (https://canvas.asu.edu/courses/44324/files/12606224/download?wrap=1)
(https://canvas.asu.edu/courses/44324/files/12606224/download?wrap=1) (Download this file. This file is complete. You need to change the header only.)
Requirements to get full credits in Documentation
The assignment number, your name, StudentID, Lecture day/time, and a class description need to be included at the top of each file/class.
A description of each method is also needed. Some additional comments inside of methods (especially for a "main" method) to explain code that are hard to follow should be written.
New Skills to be Applied
In addition to what has been covered in previous assignments, the use of the following items, discussed
in class, will probably be needed:
JavaFX, ArrayList
Classes may be needed:
Button, TextField, TextArea, Label, CheckButton, and ActionHandler. You may use other classes.
Program Description
Class Diagram:
Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels
and textfields to a user to enter information regarding clubs.
The GUI program should contain two tabs. The first tab is labeled "Club creation" and the second tab is labeled "Club Selection".
(The size of the applet here is approximately 900 X 400).
The section under the first tab should be divided into two parts:
The left part contains labels, textfields, and a button for a user to enter a club information. The right part shows "No Club" at the beginning (it is done using TextArea).
A user can enter the information of a club, and push "Create a Club" button.
Then the club information should appear on the right hand side panel (note that the format of the club information can use toString() method of the Club class). A message "Club added" should also appear with red color at the top of the panel.
Error handling:
1. If a user forgets to enter information into text field and pushes "Create a Club" button, show a message "Please fill all fields" with red color, and nothing should be added to the right hand side panel.
2. If a user enters non integer in the field for the number of member, and pushes "Create a club" button, show a message "Please enter an integer for a number of members." with red color and nothing should be added to the right hand side panel.
After entering multiple clubs, the GUI will have the following appearance.
Under the "Club Selection" tab, a user can select from those created clubs. The list of created clubs should be made using a pane containing multiple check boxes. Above the pane containing check boxes, there should be a label to display “Select some clubs”. Below the pane with check boxes, there should be a label to display “The total number of members for the selected club(s): 0”. However this label should change to show a different number of members every time a check box is checked or unchecked.
The list of clubs under the Club Selection tab should be exactly same as the list under "Club Creation" tab.
A user can check some check boxes. Every time one of the check boxes in the pane is checked or unchecked, then your program should compute the total number of members of the selected (checked) clubs and it needs to be updated in the label being displayed below.
A user should be able to go back and forth between "Club Creation" tab and "Club Selection" tab, and these two panels need to have the same list of clubs.
Class description
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.
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<ActionEvent 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.
CreatePane
CreatePane should contain at least the following instance variable:
Attribute name
Attribute type
Description
clubList
ArrayList
a list of Club objects.
selectPane
SelectPane
an object of SelectPane.
This class should have a constructor: public CreatePane(ArrayList clubList, SelectPane selectPane)
where the parameter "clubList" is passed from the Assignment6 class and the second parameter is an object of SelectPane. The constructor layouts and organizes components in this panel. You will be adding more variables (nodes/components) than what is listed here, including labels, textfields, a button, and a text area.
This class contains a nested class called ButtonHandler class that implements
EventHandler<ActionEvent interface. Thus the ButtonHandler needs to have a definition for handle method that adds some information of a club to the list and does error handling. See the UML class diagram for the parameter and return type of this method. In the handle method, you need to extract the information from the textfields. Then you can instantiate an object of the Club class and set its variable values using these values from the textfields. You can use the toString( ) method of the Club object to display the information on the textarea on the right hand side and also add the Club object to the "clubList".
Assignment6 class
Assignment6 extends Application defined in javafx.application package and should initialize itself by setting its size. It contains at least following instance variables:
Attribute
name
Attribute type
Description
clubList
ArrayList
a list of club objects. It will be used in both CreatePane and SelectPane.
selectPane
SelectPane
an object of SelectPane.
createPane
CreatePane
an object of CreatePane.
tabPane
TabPane
an object of TabPane. It will contain createPane and selectPane under each tab.
Grading Policy:
submit assignment on time indicate assignment number, name, lecture time, and description of each class clearly in each submitted java file
5 pts - Documentation (header with your name, your information, and program description for every class/file and comment/description within your code for every method)
1 pt - Indentation and spacing (easy to read)
6 pts - Required classes/methods and functionalities implemented
8 pts - Your program minimally need to have the following functionalities:
1. 2 points: Appropriate components such as textfields, labels, etc. are shown under the "Club Creation" and "Club Select" tabs.
2. 1 point: When the "Create a Club" button is pushed, the club information is added on the right panel in the correct order and the message of "club added" shows up.
3. 1 point: Error handing in case some field is not filled.
4. 1 point: Error handing in case non integer is entered for the number of members (under Club Creation).
5. 1 point: Whenever a new club is added in the club creation panel, its corresponding CheckBox is added in the club selection pane.
6. 2 points: When a check box in the club selection pane is checked or unchecked, the total number of members for selected clubs needs to be computed and updated in the label to display it. Total points: 20
--------------------------------------------
What to turn in:
-Submit your Assignment6.java, CreatePane.java, SelectPane.java, and Club.java files
using Gradescope- Assignment6 on canvas.asu.edu. Make sure that it is compiling. You can submit multiple times until the assignment deadline.