@Override public void init() { // allow multiple rows selection tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); // listener for items selection change tableView .getSelectionModel() .getSelectedIndices() .addListener( (ListChangeListener<Integer>) change -> { if (change.getList().size() > 0) { setContextMenuState(true, true, true, true); } else { setContextMenuState(false, false, false, false); } }); // prevent table columns reordering tableView .getColumns() .addListener( (ListChangeListener<TableColumn<FileItem, ?>>) change -> { change.next(); if (change.wasReplaced()) { tableView.getColumns().clear(); tableView.getColumns().addAll(selectColumn, filenameColumn, filepathColumn); } }); // set column as a CheckBox column selectColumn.setCellFactory( cellData -> { CheckBoxTableCell<FileItem, Boolean> checkBoxTableCell = new CheckBoxTableCell<>(); // set value changed listener checkBoxTableCell.setSelectedStateCallback( index -> tableView.getItems().get(index).selectedProperty()); return checkBoxTableCell; }); // add checkbox to column heading selectFilesCheckBox = new CheckBox(); selectFilesCheckBox.setDisable(true); selectColumn.setGraphic(selectFilesCheckBox); selectFilesCheckBox .selectedProperty() .addListener( (observable, oldValue, newValue) -> { synchronized (LOCK) { tableView.getItems().forEach(fileItem -> fileItem.setSelected(newValue)); } }); // set value of cells in column selectColumn.setCellValueFactory(cellData -> cellData.getValue().selectedProperty()); filenameColumn.setCellValueFactory(cellData -> cellData.getValue().filenameProperty()); filepathColumn.setCellValueFactory(cellData -> cellData.getValue().filepathProperty()); }
private void checkBoxMouseClicked(MouseEvent event, int index) { CheckBox cb = checkBoxArray[index]; int y = (int) cb.getLayoutY() + radius; if (cb.isSelected() && index < 5) { // Reader selected Ball b = new Ball(minX, maxX, minCsX, maxCsX, y, balColor1, "reader"); ballArray[index] = b; Thread t = new Thread(new BallRunnable(b, readWrite)); threadArray[index] = t; circleArray[index].setVisible(true); t.start(); } else if (cb.isSelected() && index >= 5) { // Writer selected Ball b = new Ball(minX, maxX, minCsX, maxCsX, y, balColor2, "writer"); ballArray[index] = b; Thread t = new Thread(new BallRunnable(b, readWrite)); threadArray[index] = t; circleArray[index].setVisible(true); t.start(); } else { threadArray[index].interrupt(); threadArray[index] = null; ballArray[index] = null; circleArray[index].setVisible(false); circleArray[index].setCenterX(minX); } }
@FXML public void handleSaveButtonAction() { model.saveSettings( (settings) -> { if (!goldField.getText().isEmpty()) { settings.setGoldThreshold(Integer.parseInt(goldField.getText())); } if (!elixirField.getText().isEmpty()) { settings.setElixirThreshold(Integer.parseInt(elixirField.getText())); } if (!deField.getText().isEmpty()) { settings.setDarkElixirThreshold(Integer.parseInt(deField.getText())); } if (!maxThField.getText().isEmpty()) { settings.setMaxThThreshold(Integer.parseInt(maxThField.getText())); } settings.setDetectEmptyCollectors(detectEmptyCollectorsCheckBox.isSelected()); settings.setMatchAllConditions(isMatchAllConditionsCheckBox.isSelected()); settings.setCollectResources(collectResourcesCheckBox.isSelected()); settings.setTrainMaxTroops(toInt(trainTroopsSlider.getValue())); settings.setLogLevel(logLevelComboBox.getValue()); settings.setAttackStrategy(autoAttackComboBox.getValue()); settings.getRaxInfo()[0] = rax1ComboBox.getValue(); settings.getRaxInfo()[1] = rax2ComboBox.getValue(); settings.getRaxInfo()[2] = rax3ComboBox.getValue(); settings.getRaxInfo()[3] = rax4ComboBox.getValue(); settings.getRaxInfo()[4] = rax5ComboBox.getValue(); settings.getRaxInfo()[5] = rax6ComboBox.getValue(); settings.setExtraFunctions(extraFuncCheckBox.isSelected()); }); showSettings(false); }
@FXML public void flipCoin() { coin = new Coin(); coin.flipCoin(); String flipResult = coin.getFlipResult(); String firstPlayer = ""; hboxUserMessages.setVisible(true); hboxCoinFlip.setVisible(false); if (flipResult == "Heads") { if (chkHeads.isSelected()) { computerFirst = false; firstPlayer = "You go first"; } else { computerFirst = true; firstPlayer = "I go first"; } } else if (flipResult == "Tails") { if (chkTails.isSelected()) { computerFirst = false; firstPlayer = "You go first"; } else { computerFirst = true; firstPlayer = "I go first"; } } lblMessages.setText("It was: " + flipResult + "\n" + firstPlayer); // computerFirst=false; // Update display with winner setSpotStatus(false); if (computerFirst) { computerMove(true); } }
private void updateUI() { final boolean running = model.isRunning(); final boolean scriptRunning = model.isScriptRunning(); startButton.setDisable(running || scriptRunning); stopButton.setDisable(!running && !scriptRunning); scriptsButton.setDisable(running || scriptRunning); final Settings settings = model.loadSettings(); goldField.setText(settings.getGoldThreshold() + ""); elixirField.setText(settings.getElixirThreshold() + ""); deField.setText(settings.getDarkElixirThreshold() + ""); maxThField.setText(settings.getMaxThThreshold() + ""); detectEmptyCollectorsCheckBox.setSelected(settings.isDetectEmptyCollectors()); isMatchAllConditionsCheckBox.setSelected(settings.isMatchAllConditions()); collectResourcesCheckBox.setSelected(settings.isCollectResources()); trainTroopsSlider.setValue(settings.getTrainMaxTroops()); logLevelComboBox.getSelectionModel().select(settings.getLogLevel()); autoAttackComboBox.getSelectionModel().select(settings.getAttackStrategy()); rax1ComboBox.getSelectionModel().select(settings.getRaxInfo()[0]); rax2ComboBox.getSelectionModel().select(settings.getRaxInfo()[1]); rax3ComboBox.getSelectionModel().select(settings.getRaxInfo()[2]); rax4ComboBox.getSelectionModel().select(settings.getRaxInfo()[3]); rax5ComboBox.getSelectionModel().select(settings.getRaxInfo()[4]); rax6ComboBox.getSelectionModel().select(settings.getRaxInfo()[5]); extraFuncCheckBox.setSelected(settings.isExtraFunctions()); }
private void createNewStage(int level, Stage owner, boolean onTop) { Stage stage = new Stage(); stage.initOwner(owner); stage.setTitle(level == 0 ? "Root" : "Child " + level); stage.setAlwaysOnTop(onTop); VBox root = new VBox(15); root.setPadding(new Insets(20)); Scene scene = new Scene(root); stage.setScene(scene); ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP); onTopButton.setSelected(onTop); stage .alwaysOnTopProperty() .addListener( (observable, oldValue, newValue) -> { onTopButton.setSelected(newValue); onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP); }); onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop())); CheckBox box = new CheckBox("Child stage always on top"); box.setSelected(true); Button newStageButton = new Button("Open child stage"); newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected())); root.getChildren().addAll(onTopButton, box, newStageButton); stage.show(); }
public OptionalEditor(PropertySheet.Item parameter) { if (!(parameter instanceof OptionalParameter)) throw new IllegalArgumentException(); optionalParameter = (OptionalParameter<?>) parameter; embeddedParameter = optionalParameter.getEmbeddedParameter(); // The checkbox checkBox = new CheckBox(); setLeft(checkBox); // Add embedded editor try { Class<? extends PropertyEditor<?>> embeddedEditorClass = embeddedParameter.getPropertyEditorClass().get(); embeddedEditor = embeddedEditorClass .getDeclaredConstructor(PropertySheet.Item.class) .newInstance(embeddedParameter); Node embeddedNode = embeddedEditor.getEditor(); Boolean value = optionalParameter.getValue(); if (value == null) value = false; embeddedNode.setDisable(!value); checkBox.setOnAction( e -> { embeddedNode.setDisable(!checkBox.isSelected()); }); setCenter(embeddedNode); } catch (Exception e) { throw (new IllegalStateException(e)); } }
@Override public void clearForm() { modTrans = null; amountField.setDecimal(BigDecimal.ZERO); reconciledButton.setDisable(false); reconciledButton.setSelected(false); reconciledButton.setIndeterminate(false); if (payeeTextField != null) { // transfer slips do not use the payee field payeeTextField.setEditable(true); payeeTextField.clear(); } datePicker.setEditable(true); if (!Options.rememberLastDateProperty().get()) { datePicker.setValue(LocalDate.now()); } memoTextField.clear(); numberComboBox.setValue(null); numberComboBox.setDisable(false); attachmentPane.clear(); }
private void getuserinfo(String name) throws IOException { ToServer.writeUTF("iserinfo"); ToServer.writeUTF(name); txaddname.setText(FromServer.readUTF()); txaddpass.setText(FromServer.readUTF()); txgroupname.setText(FromServer.readUTF()); if (FromServer.readUTF().equals("1")) cboxadmin.setSelected(true); else cboxadmin.setSelected(false); }
@Override public void initialize(URL url, ResourceBundle resourceBundle) { playMusic.setSelected(settings.getBoolean("playMusic", true)); playSound.setSelected(settings.getBoolean("playSound", true)); for (Node checkBox : settingsRegion.getChildrenUnmodifiable()) { HBox.setHgrow(checkBox, Priority.ALWAYS); } logo.fitWidthProperty().bind(root.widthProperty()); }
@FXML private void initialize() { // Only show visible investment accounts accountComboBox.setPredicate( account -> account.instanceOf(AccountType.INVEST) && account.isVisible()); final Preferences preferences = getPreferences(); subAccountCheckBox.setSelected(preferences.getBoolean(RECURSIVE, true)); longNameCheckBox.setSelected(preferences.getBoolean(VERBOSE, false)); }
@FXML public void clear() { User_name.requestFocus(); User_name.setText(null); pass.setText(null); Erromassage.setText(""); note.setText(null); CB1.setSelected(false); CB2.setSelected(false); }
public void setBuddy(Buddy buddy) { if (buddy != null) { iconLabel.setImage(new Image(buddy.getIcon())); nameLabel.setText(buddy.getName()); onlineCheckBox.setSelected(buddy.isOnline()); } else { iconLabel.setImage(null); nameLabel.setText(null); onlineCheckBox.setSelected(false); } }
@FXML private void handleRefresh() { final Preferences preferences = getPreferences(); preferences.putBoolean(RECURSIVE, subAccountCheckBox.isSelected()); preferences.putBoolean(VERBOSE, longNameCheckBox.isSelected()); if (refreshCallBackProperty().get() != null) { refreshCallBackProperty().get().run(); } }
@Override public Pane getVisSettings() { GridPane pane = new GridPane(); pane.setPadding(new Insets(10, 0, 0, 0)); pane.setHgap(5); pane.setVgap(5); // Dimension selection box ComboBox<String> dimCombo = new ComboBox<>(); ObservableList<String> dimensions = FXCollections.observableArrayList(); dimensions.add("X"); dimensions.add("Y"); dimensions.add("Z"); dimCombo.setItems(dimensions); dimCombo.setValue(dimensions.get(2)); dimCombo .valueProperty() .addListener( (ov, oldStr, newStr) -> { if (newStr.equals("X")) { renderer.setViewingDimension(0); } else if (newStr.equals("Y")) { renderer.setViewingDimension(1); } else { renderer.setViewingDimension(2); } renderer.render(); Controller.getInstance().updateHistogram(); }); Label dimLabel = new Label(); dimLabel.setText("Projection dimension: "); dimLabel.setLabelFor(dimCombo); pane.add(dimLabel, 0, 0); pane.add(dimCombo, 1, 0); // Scale checkbox CheckBox scaleBox = new CheckBox("Scale: "); scaleBox.setSelected(true); scaleBox .selectedProperty() .addListener( (ov, old_val, new_val) -> { renderer.setScaling(new_val); renderer.render(); }); pane.add(scaleBox, 0, 1); return pane; }
public void coinTossChoice(ActionEvent event) { Boolean isSelected; // System.out.println(event.s)); if (event.getSource().equals(chkHeads)) { chkTails.setSelected(false); btnCoinFlip.setDisable(false); } else if (event.getSource().equals(chkTails)) { chkHeads.setSelected(false); btnCoinFlip.setDisable(false); } else { btnCoinFlip.setDisable(true); } }
// METODO ENCARGADO DE HABILITAR LOS CAMPOS PARA UN NUEVO EMPLEADO @FXML private void nuevoEmpleado(ActionEvent event) { limpiarCamposEmp(); txtNombreEmpleado.setEditable(true); txtApellidoEmpleado.setEditable(true); ckbGerente.setDisable(false); ckbJefeDeBodega.setDisable(false); ckbGerente.setSelected(true); txtTelefonoEmpleado.setEditable(true); txtEmailEmpleado.setEditable(true); rbEstadoActivoEmpleado.setDisable(false); btnGuardarEmpleado.setDisable(false); btnNuevoEmpleado.setDisable(true); }
@Override public void start(Stage primaryStage) throws Exception { BorderPane outerPane = new BorderPane(); HBox topBox = new HBox(20); HBox bottomBox = new HBox(20); outerPane.setCenter(newText); fontChoice.setValue("Times New Roman"); sizeChoice.setValue(12); topBox.setPadding(new Insets(20, 20, 20, 20)); bottomBox.setPadding(new Insets(20, 20, 20, 20)); List<String> items = Font.getFamilies(); fontChoice.getItems().addAll(items); for (int i = 1; i <= 100; i++) sizeChoice.getItems().add(i); topBox.getChildren().addAll(fontName, fontChoice, fontSize, sizeChoice); bottomBox.getChildren().addAll(bold, italic); topBox.setAlignment(Pos.CENTER); bottomBox.setAlignment(Pos.CENTER); outerPane.setTop(topBox); outerPane.setCenter(newText); outerPane.setBottom(bottomBox); fontChoice.setOnAction( e -> { setFont(); }); sizeChoice.setOnAction( e -> { setFont(); }); bold.setOnAction( e -> { setFont(); }); italic.setOnAction( e -> { setFont(); }); Scene scene = new Scene(outerPane, X, Y); primaryStage.setScene(scene); primaryStage.show(); }
@Override public void start(Stage primaryStage) throws Exception { Button button = new Button("Open Root stage with child"); CheckBox box = new CheckBox("Root is always on top"); box.setSelected(true); VBox root = new VBox(15, box, button); root.setPadding(new Insets(20)); Scene scene = new Scene(root); button.setOnAction(event -> createNewStage(0, null, box.isSelected())); primaryStage.setScene(scene); primaryStage.show(); }
@Override public void handle(ActionEvent event) { if (event.getSource() instanceof CheckBox) { for (Entry<String, CheckBox> entry : propertiesCb.entrySet()) { CheckBox cb = entry.getValue(); String propertyName = entry.getKey(); if (cb.isSelected()) { propertiesTf.get(propertyName).setDisable(false); } else { propertiesTf.get(propertyName).setDisable(true); } } } }
public void setAccountTypeFilter(final AccountTypeFilter filter) { // Bind the buttons to the filter bankAccountCheckBox .selectedProperty() .bindBidirectional(filter.getAccountTypesVisibleProperty()); incomeAccountCheckBox .selectedProperty() .bindBidirectional(filter.getIncomeTypesVisibleProperty()); expenseAccountCheckBox .selectedProperty() .bindBidirectional(filter.getExpenseTypesVisibleProperty()); hiddenAccountCheckBox .selectedProperty() .bindBidirectional(filter.getHiddenTypesVisibleProperty()); }
public RNADrawingView() { // set up gui drawingPane.setPrefWidth(400); drawingPane.setPrefHeight(400); warningLabel.setTextFill(Color.RED); animateCheckbox.setSelected(false); buttonBox.getChildren().addAll(foldButton, drawButton, animateCheckbox); inputBox.getChildren().addAll(sequenceField, bracketField, buttonBox); buttonInputBox.getChildren().addAll(inputBox, warningLabel, buttonBox); drawingPane.getChildren().add(drawing); root.setTop(buttonInputBox); root.setBottom(drawingPane); buttonBox.setAlignment(Pos.BOTTOM_LEFT); inputBox.setPadding(new Insets(10, 5, 10, 5)); HBox.setMargin(foldButton, new Insets(0, 2.5, 0, 2.5)); HBox.setMargin(drawButton, new Insets(0, 2.5, 0, 2.5)); HBox.setMargin(animateCheckbox, new Insets(0, 2.5, 0, 2.5)); VBox.setMargin(sequenceField, new Insets(0, 0, 5, 0)); this.scene = new Scene(root); scene.getStylesheets().add("resources/assignment6and7.css"); drawingPane.getStyleClass().add("drawingPane"); }
public ActionFlow(TextField actionText, TextField aLeft, TextField aRight) { ActionText = actionText; this.aLeft = aLeft; this.aRight = aRight; actionBox = new CheckBox(); actionBox.setSelected(false); }
public ActionFlow(String actionText, String aLeft, String aRight) { ActionText = new TextField(actionText); this.aLeft = new TextField(aLeft); this.aRight = new TextField(aRight); actionBox = new CheckBox(); actionBox.setSelected(false); }
public FileTreePane() { loadDynamicComponentFxml(FileTreePane.class, this); rootFileTreeItem = new RootFileTreeItem(this); // The root here is *not* the real root of the file system and should be hidden, because // (1) we might want to have 'virtual' visible roots like "Home", "Desktop", "Drives" and // (2) even if we displayed only the real file system without any shortcuts like "Desktop", // we'd still have multiple roots on a crappy pseudo-OS like Windows still having these shitty // drive letters. treeTableView.setShowRoot(false); treeTableView.setRoot(rootFileTreeItem); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); treeTableView .getSelectionModel() .selectedItemProperty() .addListener( (ChangeListener<TreeItem<FileTreeItem<?>>>) (observable, o, n) -> updateSelectedFiles()); treeTableView .getSelectionModel() .getSelectedItems() .addListener((InvalidationListener) observable -> updateSelectedFiles()); selectedFiles.addListener(selectedFilesChangeListener); showHiddenFilesCheckBox.selectedProperty().bindBidirectional(showHiddenFilesProperty); // TODO remove the following line - preferably replace by proper, use-case-dependent management! selectedFiles.add(IOUtil.getUserHome()); updateDisable(); }
/** {@inheritDoc} */ @Override protected Modello buildEntity() { Modello modello = new Modello(); try { if (id != 0) { modello.setId(id); } modello.setTipoCarburante(tipoCarburante.getSelectionModel().getSelectedItem()); modello.setCapacità Bagagliaio(Integer.parseInt(capacità Bagagliaio.getText())); modello.setNumeroPorte(Integer.parseInt(numeroPorte.getText())); modello.setMarca(marca.getText()); modello.setNome(nome.getText()); modello.setEmissioniCO2(Double.parseDouble(emissioniCO2.getText())); modello.setNumeroPosti(Integer.parseInt(numeroPosti.getText())); modello.setPotenza(Integer.parseInt(potenza.getText())); modello.setPeso(Integer.parseInt(peso.getText())); modello.setTrasmissioneAutomatica(trasmissioneAutomatica.selectedProperty().get()); if (!fascia.getText().isEmpty()) modello.setFascia((Fascia) controller.processRequest("ReadFascia", fascia.getText())); else modello.setFascia(null); return modello; } catch (Exception e) { return null; } }
private void updateGroupSumView(int groupId) { // if remain mode is not selected, view of group sum is never changed if (remainMode.isSelected()) { Group group = board.getGroup(groupId); boardView.updateGroupSum(group, true); } }
/** * shows the options to edit the selected shape * * @param selectedShape the shape currently selected */ public void shapeSelected(ReactiveShape selectedShape) { shape = selectedShape; switch (shape.getShapeType()) { case ReactiveShape.RECTANGLE: type.setValue(TYPE_RECTANGLE); break; case ReactiveShape.CIRCLE: type.setValue(TYPE_CIRCLE); break; case ReactiveShape.TRIANGLE: type.setValue(TYPE_TRIANGLE); break; } backgroundPane.setVisible(false); shapePane.setVisible(true); color.setValue(shape.getColor()); filled.setSelected(shape.isFilled()); borderThickness.setText("" + shape.getBorderThickness()); borderColor.setValue(shape.getBorderColor()); width.setText("" + (int) shape.getWidth()); height.setText("" + (int) shape.getHeight()); }
public SettingsPane() { draw(); model = new SettingsModel( preloadLogtalkCheckBox.selectedProperty(), entryFilePathText.textProperty()); style(); }
public void sendRequest(String username, String password) { thisStage = (Stage) logInButton.getScene().getWindow(); Response res = new Request("user/login").set("username", username).set("password", password).send(); if (res.getSuccess()) { Main.setSessionID((String) res.get("sessionID")); System.out.println("Login successful."); Main.userNotLoggedIn.setValue(false); // Save the login option if checked if (keepMeLoggedInCheckBox.isSelected()) { pc.setProp("username", usernameTextField.getText()); pc.setProp("password", passwordPasswordField.getText()); pc.setProp("signInCheckbox", "true"); pc.saveProps(); } HomeController.userName = usernameTextField.getText(); thisStage.close(); } else { // incorrect password } }