Question
JavaFX GUI program that uses the MVC pattern. I have combo box in my GUIview program class and I need to add another combo box
JavaFX GUI program that uses the MVC pattern.
I have combo box in my GUIview program class and I need to add another combo box for down menu of years. example 2018, 2017, 2016 ....etc. how do I create, declare, and use it in the GUIcontroller. the following is part of my program in the GUIview class.
private ComboBox statusComboBox ;
private ComboBox yearComboBox;
this is my enum class
public enum Status {
ACTIVE ("AC", "Active Employee"), INACTIVE_TEMP ("IT", "Temporarily Inactive"), INACTIVE_PERM ("IP", "Permanently Inactive");
this is part only for the statusComboBox.
statusLabael = new Text("Select the Status:");
statusLabael .setFont(font);
ObservableList StatusOptions = FXCollections.observableArrayList((Arrays.asList(Status.values())));
statusComboBox = new ComboBox(StatusOptions);
statusComboBox .setValue(Status.PERMANENT);
HBox statusBox = new HBox( yearLabel, yearComboBox,StatusLabael, StatusComboBox);
statusBox .setAlignment(Pos.CENTER);
statusBox .setSpacing(20);
primaryBox.getChildren().add(statusBox );
it has it's own getters and setters
public Status getStatusField() {
return statusComboBox.getValue();
}
public void setStatusField(Status status) {
statusComboBox.setValue(status);
}
public void clearInputs() {
titleField.clear();
yearField.clear();
statusComboBox.setValue(DEFAULT_STATUS);
}
Assume I have the one Parent class, one Child class, Enum, GUIController class, GUIView class, and one for the ArrayList class to hold the lists.
My question is how do I create the same thing and pattern with this classes for the yearComboBox and put it in the HBox of, HBox statusBox = new HBox( yearLabel, yearComboBox,StatusLabael, StatusComboBox);
private ComboBox yearComboBox;
yearLabel = new Text("Select the Year:");
yearLabel.setFont(font);
do I need to create another Enum for the yearComboBox.
I need to display the year like this please, 2018, 2017, 2016, 2015, 2014
please use JavaFx.
Step 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