import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
/**
* Adds the Spinners to be able to change the number of days to move and
* number of days to show to the settings pane.
*/
private void addChangeNumberOfDaysSettings() {
// Adding the spinner to change the number of days to move.
numberOfMovingDaysSpinner = new Spinner<>();
SpinnerValueFactory valueFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 14,
controller.numberOfMovingDays);
numberOfMovingDaysSpinner.setValueFactory(valueFactory);
numberOfMovingDaysSpinner.setId("numberOfMovingDaysSpinner");
numberOfMovingDaysSpinner.setPrefWidth(70);
GridPane.setColumnIndex(numberOfMovingDaysSpinner, 2);
editDaysPane.getChildren().add(numberOfMovingDaysSpinner);
// Adding the spinner to change the number of days to show.
numberOfShowDaysSpinner = new Spinner<>();
// magik value 31 is the length of the longest month, just to be sure
SpinnerValueFactory valueShowFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 31,
controller.numberOfDays);
numberOfShowDaysSpinner.setValueFactory(valueShowFactory);
numberOfShowDaysSpinner.setId("numberOfShowDaysSpinner");
numberOfShowDaysSpinner.setPrefWidth(70);
GridPane.setColumnIndex(numberOfShowDaysSpinner, 2);
GridPane.setRowIndex(numberOfShowDaysSpinner, 1);
editDaysPane.getChildren().add(numberOfShowDaysSpinner);
// Adding the spinner to change the number of columns.
maxColumnsSpinner = new Spinner<>();
// Get the previous value from the database.
int defaultValue = Integer
.valueOf(getSetting(Controller.MAX_COLUMNS_NAME));
SpinnerValueFactory valueColumnFactory
= new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 14,
defaultValue);
maxColumnsSpinner.setValueFactory(valueColumnFactory);
maxColumnsSpinner.setId("maxColumnsSpinner");
maxColumnsSpinner.setPrefWidth(70);
GridPane.setColumnIndex(maxColumnsSpinner, 2);
GridPane.setRowIndex(maxColumnsSpinner, 2);
editDaysPane.getChildren().add(maxColumnsSpinner);
}