/** Method to read the properties and adding them to the pane */ private void readProperties() { ProfileProperties profile = PropertiesUtils.getProfile(); // Musiclibrary properties musicLibraryPath.setText(profile.getPathToMusicLibrary()); OrderingProperty orderIngProperty = profile.getOrderingMode(); if (orderIngProperty == OrderingProperty.GAA) { orderingMode.setValue(GAA); } else if (orderIngProperty == OrderingProperty.AA) { orderingMode.setValue(AA); } else { orderingMode.setValue(AAA); } if (profile.getPlayListHeader().contains("german")) { playListHeaderMode.setValue(germanHeader); } else { playListHeaderMode.setValue(englishHeader); } // Import properties keepFiles.setSelected(profile.isKeepOriginalFiles()); justTagFiles.setSelected(profile.isJustTagFiles()); // Playlist properties playListExport.setSelected(profile.isPlayListExport()); playListExportPath.setText(profile.getPlayListExportDir()); }
@FXML private void changeToJIRADefectCount(Event event) { checkLegacyDTS.setSelected(false); checkJIRA.setSelected(true); checkOther.setSelected(false); textPrefix.setDisable(true); textPrefix.setText("ECOA-"); textMax.setText("ECOA-99999"); }
/** * Initializes the controller class. This method is automatically called after fxml file has been * loaded. */ @FXML private void initialize() { // setting up the radioButtons final ToggleGroup timeIntervalGroup = new ToggleGroup(); monthlyRadioButton.setToggleGroup(timeIntervalGroup); dailyRadioButton.setToggleGroup(timeIntervalGroup); hourlyRadioButton.setToggleGroup(timeIntervalGroup); fifteenMinRadioButton.setToggleGroup(timeIntervalGroup); fifteenMinRadioButton.setSelected(true); final ToggleGroup typOfChartGroup = new ToggleGroup(); regularTimeSeriesRadioButton.setToggleGroup(typOfChartGroup); scatterRadioButton.setToggleGroup(typOfChartGroup); dailyTypeOfDayRadioButton.setToggleGroup(typOfChartGroup); regularTimeSeriesRadioButton.setSelected(true); final ToggleGroup typeOfDayGroup = new ToggleGroup(); schoolDayRadioButton.setToggleGroup(typeOfDayGroup); summerDayRadioButton.setToggleGroup(typeOfDayGroup); holidayRadioButton.setToggleGroup(typeOfDayGroup); weekendRadioButton.setToggleGroup(typeOfDayGroup); everyDayRadioButton.setToggleGroup(typeOfDayGroup); everyDayRadioButton.setSelected(true); updateEnabledButtons(); // initialize a unique instance of the database database = Database.getInstance(); // initialize the meter table with all the columns. meterNumberColumn.setCellValueFactory(cellData -> cellData.getValue().getMeterNumber()); meterTable.setEditable(true); meterNumberColumn.setCellFactory(TextFieldTableCell.forTableColumn()); meterNumberColumn.setOnEditCommit( new EventHandler<TableColumn.CellEditEvent<Meter, String>>() { @Override public void handle(CellEditEvent<Meter, String> event) { event .getTableView() .getItems() .get(event.getTablePosition().getRow()) .setMeterNumber(Assistant.parsePropertiesString(event.getNewValue())); } }); startDateColumn.setCellValueFactory( cellData -> Assistant.parsePropertiesString(cellData.getValue().getStartDate().toString())); endDateColumn.setCellValueFactory( cellData -> Assistant.parsePropertiesString(cellData.getValue().getEndDate().toString())); activatedColumn.setCellFactory(cellData -> new CheckBoxCell()); colorColumn.setCellFactory(cellData -> new ColorButtonCell(java.awt.Color.GREEN)); initializeDateTable(); }
@FXML private void changeToLegacyDefectCount(Event event) { checkLegacyDTS.setSelected(true); checkJIRA.setSelected(false); checkOther.setSelected(false); textPrefix.setDisable(false); textPrefix.setText("9999"); textPrefix.setPromptText("Enter min value"); textPrefix.setTooltip(new Tooltip("Enter min value")); textMax.setText("999999999"); }
@FXML private void changeToOtherDefectCount(Event event) { checkLegacyDTS.setSelected(false); checkJIRA.setSelected(false); checkOther.setSelected(true); textPrefix.setPromptText("Enter prefix"); textPrefix.setTooltip(new Tooltip("Enter prefix")); textPrefix.setDisable(false); textPrefix.selectAll(); textMax.setText(textPrefix.getText() + "99999"); }
@Override public void refresh() { Context context = getMainApplication().getContext(); context.setPcbPlacement(null); PCBSize pcbSize = context.getPcbSize(); if (pcbSize == null) pcbSize = SettingsFactory.getApplicationValues().getPcbSize().getValue(); if (pcbSize == PCBSize.Small) smallPCB.setSelected(true); else if (pcbSize == PCBSize.Large) largePCB.setSelected(true); errorBox.setVisible(false); ignoreErrorCheckbox.setSelected(false); updateComponents(); }
// METODO ENCARGADO DE LIMPIAR LA BUSQUEDA DE USUARIO JEFE SUCURSAL @FXML private void limpiarBusquedaSuc(ActionEvent event) { tblMostrarSucursales.getColumns().clear(); txtBuscarSucPorNombre.setText(""); txtBuscarSucPorCodigo.setText(""); btnBuscarSuc.setDisable(true); btnNuevoJefeSuc.setDisable(true); txtBuscarSucPorNombre.setEditable(false); txtBuscarSucPorCodigo.setEditable(false); btnModificarJefeSuc.setDisable(false); rbBuscarSucPorNombre.setSelected(false); rbBuscarSucPorCodigo.setSelected(false); lblMensajesSuc.setText(""); limpiarCamposSuc(); limpiarMensajesSuc(); }
// METODO QUE HABILITA EL CAMPO BUSQUEDA POR CODIGO DE EMPLEADO @FXML private void selecBuscarEmpPorCodigo(ActionEvent event) { txtBuscarEmpPorNombre.setEditable(false); txtBuscarEmpPorCodigo.setEditable(true); rbBuscarEmpPorNombre.setSelected(false); btnBuscarEmp.setDisable(false); }
// METODO ENCARGADO LIMPIAR CAMPOS DE BUSQUEDA @FXML private void limpiarBusquedaEmpleado(ActionEvent event) { tblMostrarUsuarioEmp.getColumns().clear(); txtBuscarEmpPorNombre.setText(""); txtBuscarEmpPorCodigo.setText(""); btnBuscarEmp.setDisable(true); btnNuevoEmpleado.setDisable(true); btnModificarEmpleado.setDisable(true); txtBuscarEmpPorNombre.setEditable(false); txtBuscarEmpPorCodigo.setEditable(false); rbBuscarEmpPorNombre.setSelected(false); rbBuscarEmpPorCodigo.setSelected(false); lblMensajeBd.setText(""); limpiarCamposEmp(); limpiarMensajesEmp(); }
@FXML private void selecBuscarProvPorNombre(ActionEvent event) { txtBuscarProvPorNombre.setEditable(true); txtBuscarProvPorRut.setEditable(false); rbBuscarProvPorRut.setSelected(false); btnBuscarProv.setDisable(false); }
// METODO ENCARGADO DE LIMPIAR LA BUSQUEDA DE PROVEEDORES @FXML private void limpiarBusquedaProv(ActionEvent event) { tblMostrarProveedores.getColumns().clear(); txtBuscarProvPorNombre.setText(""); txtBuscarProvPorRut.setText(""); btnBuscarProv.setDisable(true); btnNuevoProveedor.setDisable(true); txtBuscarProvPorNombre.setEditable(false); txtBuscarProvPorRut.setEditable(false); btnModificarProveedor.setDisable(false); rbBuscarProvPorNombre.setSelected(false); rbBuscarProvPorRut.setSelected(false); lblMensajesProv.setText(""); limpiarCamposProv(); limpiarMensajesProv(); }
// METODO ENCARGADO DE CARGAR LOS DATOS AL FORMULARIO EEMPLEADOS SEGUN EL ITEM SELECCIONADO private void cargarDatosEmpleadoAlFormulario(String dato) { ResultSet cargaDatosParaFormularioEmpeados = usuarioDao.datosParaFormularioEmpleados(dato); try { while (cargaDatosParaFormularioEmpeados.next()) { txtNombreEmpleado.setText( cargaDatosParaFormularioEmpeados.getString("NOMBRE_USUARIO").trim()); txtApellidoEmpleado.setText(cargaDatosParaFormularioEmpeados.getString("APELLIDOS").trim()); rbEstadoActivoEmpleado.setDisable(false); rbEstadoInactivoEmpleado.setDisable(false); String cargo = cargaDatosParaFormularioEmpeados.getString("CARGO").trim(); ckbGerente.setDisable(false); ckbJefeDeBodega.setDisable(false); if (cargo.equals("Gerente")) { ckbGerente.setSelected(true); } else { ckbJefeDeBodega.setSelected(true); } txtTelefonoEmpleado.setText(cargaDatosParaFormularioEmpeados.getString("TELEFONO").trim()); txtEmailEmpleado.setText(cargaDatosParaFormularioEmpeados.getString("E_MAIL").trim()); int estadoEmpleado = cargaDatosParaFormularioEmpeados.getInt("ESTADOID"); rbEstadoActivoEmpleado.setDisable(false); rbEstadoInactivoEmpleado.setDisable(false); if (estadoEmpleado == 1) { rbEstadoActivoEmpleado.setSelected(true); } else { rbEstadoInactivoEmpleado.setSelected(true); } } cargaDatosParaFormularioEmpeados.close(); } catch (SQLException ex) { System.out.println("Error " + ex); } txtNombreEmpleado.setEditable(true); txtApellidoEmpleado.setEditable(true); txtTelefonoEmpleado.setEditable(true); txtEmailEmpleado.setEditable(true); btnModificarEmpleado.setDisable(false); ckbGerente.setDisable(true); ckbJefeDeBodega.setDisable(true); }
private void limpiarCamposEmp() { txtNombreEmpleado.setText(""); txtNombreEmpleado.setEditable(false); txtApellidoEmpleado.setText(""); txtApellidoEmpleado.setEditable(false); ckbGerente.setSelected(false); ckbGerente.setDisable(true); ckbJefeDeBodega.setSelected(false); ckbJefeDeBodega.setDisable(true); txtTelefonoEmpleado.setText(""); txtTelefonoEmpleado.setEditable(false); txtEmailEmpleado.setText(""); txtEmailEmpleado.setEditable(false); rbEstadoActivoEmpleado.setSelected(false); rbEstadoActivoEmpleado.setDisable(true); rbEstadoInactivoEmpleado.setSelected(false); rbEstadoInactivoEmpleado.setDisable(true); }
// METODO ENCARGADO DE CARGAR LOS DATOS AL FORMULARIO PROVEEDORES SEGUN EL ITEM SELECCIONADO private void cargarDatosProveedorAlFormulario(String dato) { ResultSet cargaDatosParaFormularioProveedor = proveedorDao.datosParaFormulario(dato); try { while (cargaDatosParaFormularioProveedor.next()) { txtRutProveedor.setText(cargaDatosParaFormularioProveedor.getString("RUT").trim()); txtNombreProveedor.setText(cargaDatosParaFormularioProveedor.getString("NOMBRE").trim()); rbEstadoActivoProv.setDisable(false); rbEstadoInactivoProv.setDisable(false); txtDireccionProveedor.setText( cargaDatosParaFormularioProveedor.getString("DIRECCION").trim()); txtCiudadProveedor.setText(cargaDatosParaFormularioProveedor.getString("CIUDAD").trim()); txtTelefonoProveedor.setText( cargaDatosParaFormularioProveedor.getString("TELEFONO").trim()); txtEmailProveedor.setText(cargaDatosParaFormularioProveedor.getString("E_MAIL").trim()); cbTipos.setDisable(false); cbTipos.setValue(cargaDatosParaFormularioProveedor.getString("TIPO_DE_PRODUCTO")); estadoProveedor = cargaDatosParaFormularioProveedor.getInt("ESTADO"); rbEstadoActivoProv.setDisable(false); rbEstadoInactivoProv.setDisable(false); if (estadoProveedor == 1) { rbEstadoActivoProv.setSelected(true); } else { rbEstadoInactivoProv.setSelected(true); } } cargaDatosParaFormularioProveedor.close(); } catch (SQLException ex) { System.out.println("Error " + ex); } txtNombreProveedor.setEditable(true); txtRutProveedor.setEditable(true); txtDireccionProveedor.setEditable(true); txtCiudadProveedor.setEditable(true); txtTelefonoProveedor.setEditable(true); txtEmailProveedor.setEditable(true); btnModificarProveedor.setDisable(false); }
private void limpiarCamposProv() { txtNombreProveedor.setText(""); txtNombreProveedor.setEditable(false); txtRutProveedor.setText(""); txtRutProveedor.setEditable(false); txtCiudadProveedor.setText(""); txtCiudadProveedor.setEditable(false); txtDireccionProveedor.setText(""); txtDireccionProveedor.setEditable(false); txtTelefonoProveedor.setText(""); txtTelefonoProveedor.setEditable(false); txtEmailProveedor.setText(""); txtEmailProveedor.setEditable(false); rbEstadoActivoProv.setSelected(false); rbEstadoInactivoProv.setSelected(false); rbEstadoActivoProv.setDisable(true); rbEstadoInactivoProv.setDisable(true); btnModificarProveedor.setDisable(true); btnGuardarProveedor.setDisable(true); cbTipos.setValue("Seleccionar"); cbTipos.setDisable(true); }
private void limpiarCamposSuc() { txtNombreJefeSuc.setText(""); txtNombreJefeSuc.setEditable(false); txtApellidoJefeSuc.setText(""); txtApellidoJefeSuc.setEditable(false); txtNombreSuc.setText(""); txtNombreSuc.setEditable(false); txtCiudadSucursal.setText(""); txtCiudadSucursal.setEditable(false); txtDireccionSuc.setText(""); txtDireccionSuc.setEditable(false); txtTelefonoSuc.setText(""); txtTelefonoSuc.setEditable(false); txtEmailSuc.setText(""); txtEmailSuc.setEditable(false); rbEstadoActivoSuc.setSelected(false); rbEstadoInactivoSuc.setSelected(false); rbEstadoActivoSuc.setDisable(true); rbEstadoInactivoSuc.setDisable(true); btnModificarJefeSuc.setDisable(true); btnGuardarJefeSuc.setDisable(true); }
@Override public void initialize(URL arg0, ResourceBundle arg1) { presenter = new Presenter(); FXMLParameter = new ParametriFXML(null, false); rdMaschio.setToggleGroup(group); rdMaschio.setSelected(true); rdFemmina.setToggleGroup(group); dEmissPatente.setValue(LocalDate.of(1980, 1, 1)); dNascita.setValue(LocalDate.of(1980, 1, 1)); }
public RadioButtons() { super(400, 100); ToggleGroup tg = new ToggleGroup(); VBox vbox = new VBox(); vbox.setSpacing(5); RadioButton rb1 = new RadioButton("Hello"); rb1.setToggleGroup(tg); RadioButton rb2 = new RadioButton("Bye"); rb2.setToggleGroup(tg); rb2.setSelected(true); RadioButton rb3 = new RadioButton("Disabled"); rb3.setToggleGroup(tg); rb3.setSelected(false); rb3.setDisable(true); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); getChildren().add(vbox); }
// METODO ENCARGADO DE CARGAR LOS DATOS AL FORMULARIO SEGUN EL ITEM SELECCIONADO private void cargarDatosSucursalAlFormulario(String dato) { ResultSet cargaDatosParaFormulario = usuarioDao.datosParaFormulario(dato); try { while (cargaDatosParaFormulario.next()) { txtNombreJefeSuc.setText(cargaDatosParaFormulario.getString("NOMBRE_USUARIO").trim()); txtApellidoJefeSuc.setText(cargaDatosParaFormulario.getString("APELLIDOS").trim()); txtNombreSuc.setText(cargaDatosParaFormulario.getString("NOMBRE_SUCURSAL").trim()); txtCiudadSucursal.setText(cargaDatosParaFormulario.getString("CIUDAD").trim()); txtDireccionSuc.setText(cargaDatosParaFormulario.getString("DIRECCION").trim()); txtTelefonoSuc.setText(cargaDatosParaFormulario.getString("TELEFONO").trim()); txtEmailSuc.setText(cargaDatosParaFormulario.getString("E_MAIL").trim()); int estadoJefeSuc = cargaDatosParaFormulario.getInt("ESTADOID"); rbEstadoActivoSuc.setDisable(false); rbEstadoInactivoSuc.setDisable(false); if (estadoJefeSuc == 1) { rbEstadoActivoSuc.setSelected(true); } else { rbEstadoInactivoSuc.setSelected(true); } } cargaDatosParaFormulario.close(); } catch (SQLException ex) { System.out.println("Error " + ex); } txtNombreJefeSuc.setEditable(true); txtApellidoJefeSuc.setEditable(true); txtNombreSuc.setEditable(true); txtCiudadSucursal.setEditable(true); txtDireccionSuc.setEditable(true); txtTelefonoSuc.setEditable(true); txtEmailSuc.setEditable(true); btnModificarJefeSuc.setDisable(false); }
@FXML public void initialize() { gruppenGroesseText.setText(String.valueOf(Inputs.getGroupSize())); groupCountField.setText(String.valueOf(Inputs.getGroupCount())); if (!Inputs.isUseGroupSize()) { gruppenAnzahlRadio.setSelected(true); } // **für Testzwecke ObservableList<String> classList = FXCollections.observableArrayList("ibw2h14a", "ibd2h14b"); klasseAuswaehlenBox.setItems(classList); System.out.println("init"); // ** }
@Override public void initialize(URL arg0, ResourceBundle arg1) { textTrackName.setText(track.getName()); textDynamicRange.setText(String.format("%.2f dB", track.getDynamicRange())); drawTrack(); radioButtonActiveTrack.setToggleGroup(toggleGroup); radioButtonActiveTrack.setUserData(new WeakReference<>(track)); if (toggleGroup.getSelectedToggle() == null) { radioButtonActiveTrack.setSelected(true); } textAreaComment.textProperty().bindBidirectional(track.commentProperty()); }
private void initContent(GridPane pane) { pane.setGridLinesVisible(!true); pane.setPadding(new Insets(20)); pane.setHgap(10); pane.setVgap(10); Label names = new Label("Names:"); pane.add(names, 0, 1); Label name = new Label("Name:"); pane.add(name, 0, 3); this.names = new ListView<String>(); pane.add(this.names, 1, 1, 1, 2); this.names.setPrefWidth(200); this.names.setPrefHeight(200); this.names.getItems().setAll(this.boyNames); // GridPane.setMargin(this.boyNames, new Insets(-25, 0, 0, 0)); this.name = new TextField(); pane.add(this.name, 1, 3, 1, 1); HBox box = new HBox(20); pane.add(box, 1, 0); this.namesGroup = new ToggleGroup(); String[] gender = {"Boy", "Girl"}; for (String s : gender) { RadioButton rb = new RadioButton(); rb.setToggleGroup(this.namesGroup); rb.setText(s); box.getChildren().add(rb); rb.setSelected(true); } ChangeListener<Toggle> listener = (ov, oldValue, newValue) -> this.namesToggleSelected(); this.namesGroup.selectedToggleProperty().addListener(listener); Button add_name = new Button("Add"); pane.add(add_name, 4, 3); add_name.setOnAction(event -> this.add_name()); }
@Override public void start(Stage pPrimaryStage) { aText.setText(PART_1); pPrimaryStage.setTitle("Welcome to COMP303"); aButton.setOnAction(this); aSkin.selectedToggleProperty().addListener(this); RadioButton rb1 = new RadioButton("Plain"); rb1.setToggleGroup(aSkin); rb1.setUserData("Plain"); rb1.setSelected(true); RadioButton rb2 = new RadioButton("Floral"); rb2.setUserData("Floral"); rb2.setToggleGroup(aSkin); RadioButton rb3 = new RadioButton("Chintz"); rb3.setUserData("Chintz"); rb3.setToggleGroup(aSkin); VBox centerPanel = new VBox(MARGIN); centerPanel.setPadding(new Insets(MARGIN)); centerPanel.setAlignment(Pos.CENTER); centerPanel.getChildren().addAll(aText, aButton); BorderPane root = new BorderPane(); root.setCenter(centerPanel); HBox bottomPanel = new HBox(MARGIN); bottomPanel.setPadding(new Insets(MARGIN)); bottomPanel.setAlignment(Pos.CENTER); bottomPanel.getChildren().addAll(rb1, rb2, rb3); root.setBottom(bottomPanel); aScene = new Scene(root, WIDTH, HEIGHT); pPrimaryStage.setResizable(false); pPrimaryStage.setScene(aScene); pPrimaryStage.show(); }
/** * Called after @FXML annotated fields are injected and so is used to update the view with the * data built in the constructor. * * <p>Retrieves history and achievement information from the account to build the charts and set * the text for attribute and username labels. * * <p>First displays the user's workout activity in the last seven days but the user is allowed to * switch between last 30 days/ last 7 days charts */ @FXML private void initialize() { // build the series from the workout history information workoutHistoryLog = HistoryAnalyser.getDailyWorkoutHistoryFromCurrentAccount(); makeWeekSeriesFromAccountHistory(); makeMonthSeriesFromAccountHistory(); // ----------------------------------------------------------// // Character attributes and avatar // Get the authenticated and up to date account and get its attributes Account account = Main.account; attributes = account.getCharacterAttributes(); // ----------------------------------------------------------// // Progress charts // immediately remove the line chart that displays the last 30 days of workout activity from // view monthLineChart.setVisible(false); // add the series to their charts weekBarChart.getData().add(seriesW); monthLineChart.getData().add(seriesM); // manage the toggling feature between month and weekRadios radioGroup = new ToggleGroup(); monthRadio.setToggleGroup(radioGroup); weekRadio.setToggleGroup(radioGroup); // Initially set week radio to selected weekRadio.setSelected(true); showAccountAttributes(); showAvatarInStackPane(); showAchievementsInListView(); }
/** * Initializes the RadioButton, permits to know if a file or a directory needs to be transformed */ private void initializeRadioButtons() { folderRadio.setToggleGroup(this.radioFileGroup); fileRadio.setToggleGroup(this.radioFileGroup); this.radioFileGroup .selectedToggleProperty() .addListener( new ChangeListener<Toggle>() { @Override public void changed( ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) { if (fileRadio.isSelected()) { selectFileButton.setText("Select your subtitle file !"); isFileToConvert = true; } else { selectFileButton.setText("Select your subtitles folder !"); isFileToConvert = false; } buttonRemoveSubs.setDisable(true); } }); fileRadio.setSelected(true); }
public ConfigurationsDialogBuilder addConfigurations(List<Configuration> configurations) { dialog.setTitle("Choose a configuration to graph"); dialog.configurations = configurations; dialog.borderPanel.setCenter(dialog.scrollPane); ObservableList<Node> children = dialog.configurationsBox.getChildren(); ToggleGroup toggleGroup = new ToggleGroup(); for (Configuration configuration : configurations) { String name = configuration.getName(); RadioButton configurationRadioButton = new RadioButton(name); configurationRadioButton.setToggleGroup(toggleGroup); if (name.equals("compile")) { configurationRadioButton.setSelected(true); // todo select default from prefs } children.add(configurationRadioButton); } return this; }
@Override public void start(Stage theStage) { this.tStage = theStage; theStage.setTitle("Ball of Duty"); theStage.setHeight(WINDOW_START_HEIGHT); theStage.setWidth(WINDOW_START_WIDTH); theStage.centerOnScreen(); theStage.setResizable(false); theStage.setOnCloseRequest( new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { gameManager.quitGame(); System.exit(0); } }); BorderPane startMenuRoot = new BorderPane(); startMenu = new Scene(startMenuRoot); gameBox = new BorderPane(); Scene gameScene = new Scene(gameBox); BorderPane createAccountRoot = new BorderPane(); BorderPane lohInRoot = new BorderPane(); theStage.setScene(startMenu); gameManager = new GameClient(getRelativeSceneLocation(theStage)); scale = new Scale(); scale.xProperty().bind(gameScene.widthProperty().divide(WINDOW_START_WIDTH)); scale.yProperty().bind(gameScene.heightProperty().divide(WINDOW_START_HEIGHT)); scale.setPivotX(0); scale.setPivotY(0); // gameBox.getTransforms().add(scale); // gameBox.setBackground(null); // TODO scaling theStage .heightProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); // This // only // happens // once // for // some // reason. }); theStage .widthProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); theStage .xProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); theStage .yProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); gameScene .xProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); gameScene .yProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); Image image = new Image("images/frontpage.png"); BackgroundSize backgroundSize = new BackgroundSize(100, 100, true, true, true, false); // new BackgroundImage(image, repeatX, repeatY, position, size) BackgroundImage backgroundImage = new BackgroundImage( image, BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize); // new Background(images...) Background background = new Background(backgroundImage); startMenuRoot.setBackground(background); RadioButton chooseBlaster = new RadioButton("Blaster"); RadioButton chooseRoller = new RadioButton("Roller"); RadioButton chooseHeavy = new RadioButton("Heavy"); final ToggleGroup specializationGroup = new ToggleGroup(); chooseBlaster.setToggleGroup(specializationGroup); chooseRoller.setToggleGroup(specializationGroup); chooseHeavy.setToggleGroup(specializationGroup); chooseBlaster.setSelected(true); HBox specializationBox = new HBox(); specializationBox.setSpacing(9); specializationBox.getChildren().add(chooseBlaster); specializationBox.getChildren().add(chooseRoller); specializationBox.getChildren().add(chooseHeavy); Label lblNickname = new Label("Nickname:"); TextField tfNickname = new TextField(); Button loginStart = new Button("Log in"); Button createStart = new Button("Create Account"); theStage.getIcons().add(new Image("images/ball_red.png")); VBox mainButtonBox = new VBox(); mainButtonBox.setSpacing(5); Button joinBtn = new Button("Join game"); Button viewLB = new Button("Leaderboard"); viewLB.setPrefSize(150, 50); viewLB.setId("viewLB"); viewLB.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); BorderPane lbBorder = new BorderPane(); VBox lbBox = new VBox(); Scene lbScene = new Scene(lbBorder); Button lbBack = new Button("Start menu"); lbBox.getChildren().add(lbBack); lbBorder.setLeft(lbBox); lbBack.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); Label topText = new Label("Only shows scores higher than 100!"); topText.setStyle("-fx-font-size: 20pt;-fx-font-family: Segoe UI Semibold;"); viewLB.setOnAction( ActionEvent -> { HighscoreLeaderboard hBoard = gameManager.getHighscoreLeaderboard(); hBoard.setFocusTraversable(false); lbBorder.setCenter(hBoard); if (gameManager.getPlayer() != null) { Player client = gameManager.getPlayer(); Label you = new Label( "YOU: " + client.getNickname() + " [" + client.getId() + "] | Score: " + client.getHighscore()); you.setStyle("-fx-font-size: 15pt;-fx-font-family: Segoe UI Semibold;"); lbBorder.setBottom(you); } BorderPane.setMargin(hBoard, new Insets(12, 12, 12, 12)); lbBorder.setTop(topText); theStage.setScene(lbScene); lbBack.setOnAction( ActionEvent1 -> { theStage.setScene(startMenu); startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); joinBtn.setPrefSize(150, 50); tfNickname.setPrefSize(150, 20); joinBtn.setId("joinBtn"); joinBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblNickname.setId("lblNickname"); lblNickname.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); createStart.setId("CreateStart"); createStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); loginStart.setId("loginStart"); loginStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); joinBtn.setOnAction( ActionEvent -> { Specializations spec; if (chooseRoller.isSelected()) { spec = Specializations.ROLLER; } else if (chooseHeavy.isSelected()) { spec = Specializations.HEAVY; } else // Blaster is default, if something goes wrong with radio // buttons { spec = Specializations.BLASTER; } theStage.setScene(gameScene); gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec); gameManager.getMap().addObserver(this); gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); gameBox.requestFocus(); }); tfNickname.setOnAction( ActionEvent -> { Specializations spec; if (chooseRoller.isSelected()) { spec = Specializations.ROLLER; } else if (chooseHeavy.isSelected()) { spec = Specializations.HEAVY; } else // Blaster is default, if something goes wrong with radio // buttons { spec = Specializations.BLASTER; } theStage.setScene(gameScene); gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec); gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); gameBox.requestFocus(); }); mainButtonBox.getChildren().add(lblNickname); mainButtonBox.getChildren().add(tfNickname); mainButtonBox.getChildren().add(specializationBox); mainButtonBox.getChildren().add(joinBtn); mainButtonBox.getChildren().add(loginStart); mainButtonBox.getChildren().add(createStart); mainButtonBox.getChildren().add(viewLB); startMenuRoot.setLeft(mainButtonBox); createStart.setOnAction( ActionEvent -> { VBox createAccountButtonBox = new VBox(); Label lblNickname2 = new Label("Nickname:"); TextField tfNickname2 = new TextField(); Label lblUserName = new Label("Name:"); TextField tfUserName = new TextField(); Label lblPassword = new Label("Password:"******"Repeat password:"******"Create account"); Button back = new Button("Start menu"); createBtn.setId("join-yyyyy"); createBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblUserName.setId("join-game"); lblUserName.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblPassword.setId("join-game"); lblPassword.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblPassword2.setId("join-game"); lblPassword2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); back.setId("join-game"); back.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); createAccountButtonBox.getChildren().add(lblNickname2); createAccountButtonBox.getChildren().add(tfNickname2); createAccountButtonBox.getChildren().add(lblUserName); createAccountButtonBox.getChildren().add(tfUserName); createAccountButtonBox.getChildren().add(lblPassword); createAccountButtonBox.getChildren().add(pf); createAccountButtonBox.getChildren().add(lblPassword2); createAccountButtonBox.getChildren().add(pf2); createAccountButtonBox.getChildren().add(createBtn); createAccountButtonBox.getChildren().add(back); startMenuRoot.setLeft(createAccountButtonBox); BorderPane.setMargin(createAccountButtonBox, new Insets(350, 0, 0, 150)); createBtn.setOnAction( ActionEvent1 -> { gameManager.createAccount( tfUserName.getText(), tfNickname2.getText(), pf.getText().toCharArray(), pf2.getText().toCharArray()); startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); back.setOnAction( ActionEvent1 -> { startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); loginStart.setOnAction( ActionEvent -> { VBox loginButtonBox = new VBox(); Button logInBtn = new Button("Log in"); Label lblUserName2 = new Label("Name:"); TextField tfUserName2 = new TextField(); Label lblPassword2 = new Label("Password:"******"Start Menu"); logInBtn.setId("join-game"); logInBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); back2.setId("join-game"); back2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); loginButtonBox.getChildren().add(lblUserName2); loginButtonBox.getChildren().add(tfUserName2); loginButtonBox.getChildren().add(lblPassword2); loginButtonBox.getChildren().add(pf3); loginButtonBox.getChildren().add(logInBtn); loginButtonBox.getChildren().add(back2); startMenuRoot.setLeft(loginButtonBox); BorderPane.setMargin(loginButtonBox, new Insets(350, 0, 0, 150)); logInBtn.setOnAction( ActionEvent1 -> { // TODO login }); back2.setOnAction( ActionEvent1 -> { startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); Button quitBtn = new Button("Quit game"); quitBtn.setPrefSize(80, 40); quitBtn.setId("quit-game"); quitBtn.setOnAction( ActionEvent -> { gameManager.quitGame(); theStage.setScene(startMenu); }); canvas = new Canvas(CANVAS_START_WIDTH, CANVAS_START_HEIGHT); gameBox.setCenter(canvas); BorderPane.setAlignment(canvas, Pos.TOP_LEFT); gameBox.setBottom(quitBtn); BorderPane.setAlignment(quitBtn, Pos.TOP_LEFT); theStage.show(); }
@SuppressWarnings("unchecked") @Override public void initialize(URL location, ResourceBundle resources) { super.initialize(location, resources); ToggleGroup gender = new ToggleGroup(); gender.getToggles().add(male); gender.getToggles().add(female); male.setSelected(true); this.townships.getItems().addAll((List<Township>) ApplicationContext.get(CommonList.Township)); // students this.studentList.getItems().addAll((List<Student>) ApplicationContext.get(CommonList.Student)); this.studentList .getSelectionModel() .selectedItemProperty() .addListener( (a, b, c) -> { if (null != c) { setStudent(this.studentList.getSelectionModel().getSelectedItem()); needToPay.getSelectionModel().clearSelection(); } }); // students to pay this.needToPay.getItems().addAll(StudentBroker.getInstance().getAllToPaid()); this.needToPay .getSelectionModel() .selectedItemProperty() .addListener( (a, b, c) -> { if (null != c) { setStudent(this.needToPay.getSelectionModel().getSelectedItem()); studentList.getSelectionModel().clearSelection(); } }); // init list this.classList .getSelectionModel() .selectedItemProperty() .addListener( (a, b, c) -> { this.edit.setDisable(false); this.submit.setDisable(false); this.pay.setEditable(true); // set bills StudentJdc jdc = classList.getSelectionModel().getSelectedItem(); this.billList.getItems().clear(); List<Bill> bills = StudentBroker.getInstance().getBillByJdcClass(jdc); this.billList.getItems().addAll(bills); // set balance if (null != bills && bills.size() > 0) { this.courseFee.setText( String.valueOf( bills .get(bills.size() - 1) .getStudentJdc() .getJdcClass() .getCourse() .getFee())); this.discount.setText(String.valueOf(bills.get(bills.size() - 1).getDiscount())); this.fee.setText(substract.apply(this.courseFee, this.discount)); this.paid.setText(String.valueOf(bills.stream().mapToInt(v -> v.getPaid()).sum())); this.remain.setText(substract.apply(this.fee, this.paid)); this.pay.clear(); if ("0".equals(this.remain.getText())) { this.pay.setEditable(false); this.submit.setDisable(true); } } else { clearTextFields.accept( Arrays.asList(courseFee, discount, fee, paid, remain) .toArray(new TextField[5])); } }); filter .textProperty() .addListener( (a, b, c) -> studentListFilter = (w, list) -> { final List<Student> students = new ArrayList<>(); if (null == w || w.isEmpty()) { students.addAll(StudentBroker.getInstance().getAllToPaid()); } else { students.addAll( list.getItems() .stream() .filter(s -> s.getName().startsWith(w)) .collect(Collectors.toList())); } list.getItems().clear(); list.getItems().addAll(students); }); filter.textProperty().addListener((a, b, c) -> studentListFilter.accept(c, studentList)); cancel.setOnAction( e -> { setEditMode(false); edit.setText("Edit"); }); this.submit.setOnAction(StudentsController.this::paid); this.edit.setOnAction( e -> { if ("Edit".equals(((Button) e.getSource()).getText())) { this.setEditMode(true); edit.setText("Save"); } else { boolean fromTop = this.needToPay.getSelectionModel().getSelectedItem() != null; this.setEditMode(false); Student stu = getStudent(); StudentBroker.getInstance().update(stu, Student.class); ApplicationContext.put(CommonList.Student, StudentBroker.getInstance().getAll()); this.studentList.getItems().clear(); this.studentList .getItems() .addAll((List<Student>) ApplicationContext.get(CommonList.Student)); this.needToPay.getItems().clear(); this.needToPay.getItems().addAll(StudentBroker.getInstance().getAllToPaid()); if (fromTop) { this.selectById(stu.getId(), needToPay); } else { this.selectById(stu.getId(), studentList); } edit.setText("Edit"); } }); }
/** * When the component is created, it initialize the component representation and adding listener * and MouseEvent * * @param location type URL * @param resources type ResourceBundle */ @Override public void initialize(final URL location, final ResourceBundle resources) { super.initialize(location, resources); // Configure exponential potentiometer expFrequency .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setExponentialFrequency((double) newValue); updateScreen(); linFrequency.setMinValue( String.valueOf( (int) (vcoa.getLinearFrequencyMin() * vcoa.getExponentialFrequency()))); linFrequency.setMaxValue( String.valueOf( (int) (vcoa.getLinearFrequencyMax() * vcoa.getExponentialFrequency()))); }); expFrequency.setTitle("Exp. Freq."); expFrequency.setMinValue(0); expFrequency.setMaxValue(16); // Configure linear potentiometer linFrequency .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setLinearFrequency((Double) newValue); updateScreen(); }); linFrequency.setTitle("Linear Freq."); // Configure amplitude potentiometer amplitude .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setAmplitudeOscillator((Double) newValue); }); amplitude.setTitle("Amplitude"); amplitude.setMinValue("0%"); amplitude.setMaxValue("100%"); sineRadio.setToggleGroup(groupRadio); squareRadio.setToggleGroup(groupRadio); triangleRadio.setToggleGroup(groupRadio); sawtoothRadio.setToggleGroup(groupRadio); sineRadio.setUserData("sineWave"); squareRadio.setUserData("squareWave"); triangleRadio.setUserData("triangleWave"); sawtoothRadio.setUserData("sawtoothWave"); groupRadio .selectedToggleProperty() .addListener( (observable, oldValue, newValue) -> { if (groupRadio.getSelectedToggle() != null) { final Image image = new Image( getClass() .getResourceAsStream( "/ui/images/" + groupRadio.getSelectedToggle().getUserData() + ".png")); oscillatorImage.setImage(image); switch (groupRadio.getSelectedToggle().getUserData().toString()) { case "sineWave": vcoa.setOscillatorType(OscillatorType.SINE); break; case "squareWave": vcoa.setOscillatorType(OscillatorType.SQUARE); break; case "triangleWave": vcoa.setOscillatorType(OscillatorType.TRIANGLE); break; case "sawtoothWave": vcoa.setOscillatorType(OscillatorType.SAWTOOTH); break; default: break; } } }); squareRadio.setSelected(true); }
@FXML private void initialize() { final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT); if (engine != null) { accountSeparatorTextField.setText(engine.getAccountSeparator()); accountSeparatorTextField .textProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue != null && newValue.length() > 0) { engine.setAccountSeparator(newValue); } }); } else { accountSeparatorTextField.setDisable(true); } useAccountingTermsCheckBox .selectedProperty() .bindBidirectional(Options.useAccountingTermsProperty()); switch (AccountBalanceDisplayManager.getDisplayMode()) { case NONE: noAccountsRadioButton.setSelected(true); break; case REVERSE_CREDIT: creditAccountsRadioButton.setSelected(true); break; case REVERSE_INCOME_EXPENSE: incomeExpenseAccountsRadioButton.setSelected(true); break; } noAccountsRadioButton .selectedProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue) { AccountBalanceDisplayManager.setDisplayMode(AccountBalanceDisplayMode.NONE); } }); creditAccountsRadioButton .selectedProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue) { AccountBalanceDisplayManager.setDisplayMode( AccountBalanceDisplayMode.REVERSE_CREDIT); } }); incomeExpenseAccountsRadioButton .selectedProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue) { AccountBalanceDisplayManager.setDisplayMode( AccountBalanceDisplayMode.REVERSE_INCOME_EXPENSE); } }); }