List of usage examples for javafx.scene.control CheckBox setSelected
public final void setSelected(boolean value)
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);//w w w .j av a 2 s . c o m stage.setHeight(150); final CheckBox cb = new CheckBox(); cb.setText("checkBox"); cb.setSelected(true); cb.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) { System.out.println(cb.isSelected()); } }); ((Group) scene.getRoot()).getChildren().add(cb); stage.setScene(scene); stage.show(); }
From source file:de.rkl.tools.tzconv.view.ZoneIdSelectionDialog.java
private Node createZoneIdSelectionBox() { final HBox mainListBox = new HBox(5); partition(newArrayList(ApplicationModel.ZONE_OFFSETS_2_ZONE_IDS.values()), 40).forEach(zoneIds -> { final VBox columnBox = new VBox(5); zoneIds.forEach(zoneId -> {/*from w w w . ja va 2 s .c o m*/ final CheckBox zoneIdCheckbox = new CheckBox(zoneId.toString()); zoneIdCheckbox.setSelected(applicationModel.selectedZoneIds.contains(zoneId)); zoneIdCheckbox.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { pendingSelectedZoneIds.add(zoneId); } else { pendingSelectedZoneIds.remove(zoneId); } }); columnBox.getChildren().add(zoneIdCheckbox); zoneIdCheckboxes.add(zoneIdCheckbox); }); mainListBox.getChildren().add(columnBox); }); return mainListBox; }
From source file:io.bitsquare.gui.components.paymentmethods.OKPayForm.java
private void addCurrenciesGrid(boolean isEditable) { Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0); GridPane.setValignment(label, VPos.TOP); FlowPane flowPane = new FlowPane(); flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10);/*from w ww . j av a2s . c o m*/ flowPane.setHgap(10); if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> { CheckBox checkBox = new CheckBox(e.getCode()); checkBox.setMouseTransparent(!isEditable); checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e)); checkBox.setMinWidth(60); checkBox.setMaxWidth(checkBox.getMinWidth()); checkBox.setTooltip(new Tooltip(e.getName())); checkBox.setOnAction(event -> { if (checkBox.isSelected()) okPayAccount.addCurrency(e); else okPayAccount.removeCurrency(e); updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }); GridPane.setRowIndex(flowPane, gridRow); GridPane.setColumnIndex(flowPane, 1); gridPane.getChildren().add(flowPane); }
From source file:de.perdoctus.ebikeconnect.gui.dialogs.LoginDialog.java
@PostConstruct public void init() { final ImageView graphic = new ImageView( new Image(getClass().getResource("/app-icon.png").toExternalForm())); graphic.setPreserveRatio(true);//from w w w . ja v a 2 s. c o m graphic.setFitHeight(64); setGraphic(graphic); setResizable(true); setWidth(400); setResizable(false); setTitle(rb.getString("dialogTitle")); setHeaderText(rb.getString("dialogMessage")); final ButtonType loginButtonType = new ButtonType(rb.getString("loginButton"), ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); // Create the username and password labels and fields. final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 10, 10, 10)); grid.setPrefWidth(getWidth()); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.NEVER, HPos.LEFT, true)); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.ALWAYS, HPos.LEFT, true)); final String rbUsername = rb.getString(CFG_USERNAME); final TextField txtUsername = new TextField(); txtUsername.setPromptText(rbUsername); txtUsername.setText(config.getString(CFG_USERNAME, "")); final Label lblUsername = new Label(rbUsername); lblUsername.setLabelFor(txtUsername); grid.add(lblUsername, 0, 0); grid.add(txtUsername, 1, 0); final String rbPassword = rb.getString(CFG_PASSWORD); final PasswordField txtPassword = new PasswordField(); txtPassword.setPromptText(rbPassword); if (config.getBoolean(CFG_SAVE_PASSWORD, false)) { txtPassword.setText(config.getString(CFG_PASSWORD, "")); } final Label lblPassword = new Label(rbPassword); lblPassword.setLabelFor(txtPassword); grid.add(lblPassword, 0, 1); grid.add(txtPassword, 1, 1); final CheckBox cbSavePassword = new CheckBox(rb.getString("save-password")); cbSavePassword.setSelected(config.getBoolean(CFG_SAVE_PASSWORD, false)); grid.add(cbSavePassword, 1, 2); getDialogPane().setContent(grid); // Enable/Disable login button depending on whether a username was entered. final Node loginButton = getDialogPane().lookupButton(loginButtonType); loginButton.disableProperty() .bind(txtUsername.textProperty().isEmpty().or(txtPassword.textProperty().isEmpty())); setResultConverter(buttonType -> { if (buttonType == loginButtonType) { config.setProperty(CFG_USERNAME, txtUsername.getText()); config.setProperty(CFG_SAVE_PASSWORD, cbSavePassword.isSelected()); if (cbSavePassword.isSelected()) { config.setProperty(CFG_PASSWORD, txtPassword.getText()); config.setProperty(CFG_PASSWORD, txtPassword.getText()); } else { config.clearProperty(CFG_PASSWORD); } return new Credentials(txtUsername.getText(), txtPassword.getText()); } else { return null; } }); if (txtUsername.getText().isEmpty()) { txtUsername.requestFocus(); } else { txtPassword.requestFocus(); txtPassword.selectAll(); } }
From source file:de.rkl.tools.tzconv.TimezoneConverter.java
private Node createTemplateCheckbox() { final CheckBox templateCheckBox = new CheckBox("Use text template"); templateCheckBox.setSelected(applicationModel.templateFile.getValue() != null); applicationModel.templateFile.addListener((observable, oldValue, newValue) -> { templateCheckBox.setSelected(newValue != null); });/*from www.j av a 2 s.c o m*/ templateCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> { if (oldValue) applicationModel.templateFile.set(null); }); return templateCheckBox; }
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
public void clear() { List<HBox> toDelete = new ArrayList<>(); for (Node node : vboxRadios.getChildren()) { HBox hbox = (HBox) node;//from www . j ava 2 s . c om boolean delete = false; for (Node hNode : hbox.getChildren()) { if (hNode instanceof CheckBox) { CheckBox chk = (CheckBox) hNode; chk.setSelected(false); delete = chk.getId().startsWith("external"); } } if (delete) { toDelete.add(hbox); } } vboxRadios.getChildren().removeAll(toDelete); }
From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java
@Override public Node getConfigFrame() { // TODO: Remove code redundancies; element creating methods have been created in class AutomatonEdge and should be centralized! final ConfigFrame cf = new ConfigFrame("State properties"); final int nameInputLines = 1; final TextArea nameInput = new TextArea(this.name); nameInput.setPrefRowCount(nameInputLines); nameInput.setWrapText(true);//from w w w . ja v a 2s.c om nameInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setName(newValue); this.getGraph().handleChange(); }); cf.addOption("Name", nameInput); final int descriptionInputLines = 3; this.createTextAreaInput(descriptionInputLines, cf, "Description", this.getDescription(), newValue -> this.setDescription(newValue)); final VBox typeAttributes = new VBox(); final ToggleGroup flagToggleGroup = new ToggleGroup(); typeAttributes.getChildren() .add(this.createRadioButtonForType(null, "None (intermediate node)", flagToggleGroup)); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.INITIAL, "Initial", flagToggleGroup)); final RadioButton successOption = this.createRadioButtonForType(Type.SUCCESS, "Success", flagToggleGroup); typeAttributes.getChildren().add(successOption); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.FAILURE, "Failure", flagToggleGroup)); cf.addOption("Type", typeAttributes); final CheckBox waitCheckBox = new CheckBox("Active"); waitCheckBox.setSelected(this.wait); waitCheckBox.setOnAction(event -> { this.setWait(waitCheckBox.isSelected()); this.getGraph().handleChange(); }); cf.addOption("Wait", waitCheckBox); final int expressionInputLines = 1; final TextArea successCheckExpInput = new TextArea(this.successCheckExp); successCheckExpInput.setStyle("-fx-font-family: monospace"); successCheckExpInput.setPrefRowCount(expressionInputLines); successCheckExpInput.setWrapText(false); successCheckExpInput.textProperty() .addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setSuccessCheckExp(newValue); this.getGraph().handleChange(); }); successCheckExpInput.disableProperty().bind(successOption.selectedProperty().not()); cf.addOption("Script expression to verify if node is successful", successCheckExpInput); this.createEnterAndLeaveScriptConfig(cf); return cf; }
From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java
public void loadIsos(Configuration config) { for (String iso : config.getIsos()) { CheckBox chk = getCheckById(iso); if (chk != null) { // Internal chk.setSelected(true); } else {//from w w w.j a v a 2 s . c om // External File file = new File(iso); File fileConf = new File(DPFManagerProperties.getIsosDir() + "/" + iso); if (file.exists() && file.isFile()) { addExternalCheckBox(iso, true); } else if (fileConf.exists() && fileConf.isFile()) { CheckBox chk2 = getCheckById("config" + fileConf.getName()); if (chk2 != null) { chk2.setSelected(true); } } } } }
From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java
private void updateCheckBox(Boolean value, CheckBox ruleEnabled) { if (value == null) { ruleEnabled.setSelected(false); } else {// www.j av a2 s.c o m ruleEnabled.setSelected(value); } }
From source file:ninja.javafx.smartcsv.fx.validation.ValidationEditorController.java
private void updateSpinner(Spinner rule, Integer value, CheckBox ruleEnabled) { if (value == null) { ruleEnabled.setSelected(false); } else {/* w ww .j a va2s. c o m*/ ruleEnabled.setSelected(true); rule.getValueFactory().setValue(value); } }