Java Code Examples for javafx.scene.control.CheckBox#setSelected()

The following examples show how to use javafx.scene.control.CheckBox#setSelected() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightOptions.java    From LogFX with GNU General Public License v3.0 6 votes vote down vote up
Row( String pattern, Paint backgroundColor, Paint fillColor, boolean isFiltered ) {
    setSpacing( 5 );

    expressionField = new TextField( pattern );
    expressionField.setMinWidth( 300 );
    expressionField.setTooltip( new Tooltip( "Enter a regular expression." ) );

    bkgColorPicker = new ColorChooser( backgroundColor.toString(), "Enter the background color." );
    fillColorPicker = new ColorChooser( fillColor.toString(), "Enter the text color." );

    isFilteredBox = new CheckBox();
    isFilteredBox.setSelected( isFiltered );
    isFilteredBox.setTooltip( new Tooltip( "Include in filter" ) );

    InvalidationListener updater = ( ignore ) ->
            update( bkgColorPicker.getColor(), fillColorPicker.getColor(), isFilteredBox.selectedProperty().get() );

    bkgColorPicker.addListener( updater );
    fillColorPicker.addListener( updater );
    isFilteredBox.selectedProperty().addListener( updater );
    expressionField.textProperty().addListener( updater );

    setMinWidth( 500 );
}
 
Example 2
Source File: EditAnnotationDialog.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void updateItem(AnnotationItem item, boolean empty)
{
	super.updateItem(item, empty);
	if (item == null)
		return;
	String text = item.annotation.getTrace().getLabel() + ": " + item.annotation.getText().replaceAll("\n", "\\\\n");
	if (text.length() > MAX_LENGTH)
		text = text.substring(0, MAX_LENGTH) + "...";
	final CheckBox selector = new CheckBox(text);
	selector.setTextFill(item.annotation.getTrace().getColor());
	selector.setSelected(true);
	final Button edit = new Button(Messages.AnnotationEditBtn);
	final BorderPane line = new BorderPane();
	line.setLeft(selector);
	line.setRight(edit);
	setGraphic(line); // 'Graphic' == any Node that represents the cell

	selector.setOnAction(event -> item.selected = selector.isSelected());
	edit.setOnAction(event -> editAnnotation(item.annotation));
}
 
Example 3
Source File: SimpleCheckBoxControl.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * This method creates node and adds them to checkboxes and is
 * used when the itemsProperty on the field changes.
 */
private void createCheckboxes() {
  node.getChildren().clear();
  checkboxes.clear();

  for (int i = 0; i < field.getItems().size(); i++) {
    CheckBox cb = new CheckBox();

    cb.setText(field.getItems().get(i).toString());
    cb.setSelected(field.getSelection().contains(field.getItems().get(i)));

    checkboxes.add(cb);
  }

  node.getChildren().addAll(checkboxes);
}
 
Example 4
Source File: LayerTreeCell.java    From arcgis-runtime-samples-java with Apache License 2.0 6 votes vote down vote up
@Override
public void updateItem(Layer layer, boolean empty) {
  super.updateItem(layer, empty);
  if (!empty) {
    // use the layer's name for the text
    setText(layer.getName());

    // add a check box to allow the user to change the visibility of the layer
    CheckBox checkBox = new CheckBox();
    setGraphic(checkBox);

    // toggle the layer's visibility when the check box is toggled
    checkBox.setSelected(layer.isVisible());
    checkBox.selectedProperty().addListener(e -> layer.setVisible(checkBox.isSelected()));
  } else {
    setText(null);
    setGraphic(null);
  }
}
 
Example 5
Source File: JavaFXCheckBoxElementTest.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Test
public void selectCheckboxSelectedNotSelected() throws Throwable {
    CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box");
    checkBoxNode.setSelected(true);
    AssertJUnit.assertEquals(true, checkBoxNode.isSelected());
    checkBox.marathon_select("unchecked");
    new Wait("Waiting for the check box deselect.") {
        @Override
        public boolean until() {
            return !checkBoxNode.isSelected();
        }
    };
}
 
Example 6
Source File: SnapshotTable.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
SelectionTableColumn() {
    super("", "Include this PV when restoring values", 30, 30, false);
    setCellValueFactory(new PropertyValueFactory<>("selected"));
    //for those entries, which have a read-only property, disable the checkbox
    setCellFactory(column -> {
        TableCell<TableEntry, Boolean> cell = new CheckBoxTableCell<>(null,null);
        cell.itemProperty().addListener((a, o, n) -> {
            cell.getStyleClass().remove("check-box-table-cell-disabled");
            TableRow<?> row = cell.getTableRow();
            if (row != null) {
                TableEntry item = (TableEntry) row.getItem();
                if (item != null) {
                    cell.setEditable(!item.readOnlyProperty().get());
                    if (item.readOnlyProperty().get()) {
                        cell.getStyleClass().add("check-box-table-cell-disabled");
                    }
                }
            }
        });
        return cell;
    });
    setEditable(true);
    setSortable(false);
    selectAllCheckBox = new CheckBox();
    selectAllCheckBox.setSelected(false);
    selectAllCheckBox.setOnAction(e -> getItems().stream().filter(te -> !te.readOnlyProperty().get())
            .forEach(te -> te.selectedProperty().setValue(selectAllCheckBox.isSelected())));
    setGraphic(selectAllCheckBox);
    MenuItem inverseMI = new MenuItem("Inverse Selection");
    inverseMI.setOnAction(e -> getItems().stream().filter(te -> !te.readOnlyProperty().get())
            .forEach(te -> te.selectedProperty().setValue(!te.selectedProperty().get())));
    final ContextMenu contextMenu = new ContextMenu(inverseMI);
    selectAllCheckBox.setOnMouseReleased(e -> {
        if (e.getButton() == MouseButton.SECONDARY) {
            contextMenu.show(selectAllCheckBox, e.getScreenX(), e.getScreenY());
        }
    });
}
 
Example 7
Source File: Overlay.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void addDontShowAgainCheckBox(boolean isChecked) {
    if (dontShowAgainId != null) {
        // We might have set it and overridden the default, so we check if it is not set
        if (dontShowAgainText == null)
            dontShowAgainText = Res.get("popup.doNotShowAgain");

        CheckBox dontShowAgainCheckBox = new AutoTooltipCheckBox(dontShowAgainText);
        HBox.setHgrow(dontShowAgainCheckBox, Priority.NEVER);
        buttonBox.getChildren().add(0, dontShowAgainCheckBox);

        dontShowAgainCheckBox.setSelected(isChecked);
        DontShowAgainLookup.dontShowAgain(dontShowAgainId, isChecked);
        dontShowAgainCheckBox.setOnAction(e -> DontShowAgainLookup.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected()));
    }
}
 
Example 8
Source File: RememberingChoiceDialog.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Alert create(final String title,
                           final String header,
                           final String htmlContent,
                           final String checkboxContentKey,
                           final PropertyContext context,
                           final String option
)
{
	GuiAssertions.assertIsNotJavaFXThread();
	Objects.requireNonNull(title);
	Objects.requireNonNull(header);
	Objects.requireNonNull(htmlContent);
	Objects.requireNonNull(context);
	Objects.requireNonNull(option);

	Alert alert = GuiUtility.runOnJavaFXThreadNow(() -> new Alert(Alert.AlertType.INFORMATION));
	alert.setTitle(title);
	alert.setContentText(null);
	alert.setHeaderText(header);
	CheckBox showLicense = new CheckBox(LanguageBundle.getString(checkboxContentKey));
	showLicense.selectedProperty().addListener((observableValue, oldValue, newValue) ->
               context.setBoolean(option, newValue));
	showLicense.setSelected(context.getBoolean(option));
	Platform.runLater(() -> {
		WebView webView = new WebView();
		webView.getEngine().loadContent(htmlContent);
		alert.getDialogPane().setContent(webView);
	});
	alert.getDialogPane().setExpandableContent(showLicense);
	return alert;
}
 
Example 9
Source File: GameElimniationController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@FXML
protected void allCountedImagesAction() {
    if (isSettingValues) {
        return;
    }
    for (Node node : countedImagesPane.getChildren()) {
        CheckBox cbox = (CheckBox) node;
        cbox.setSelected(true);
    }
}
 
Example 10
Source File: TestbedSidePanel.java    From jbox2d with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void addSettings(Pane argPanel, TestbedSettings argSettings, SettingType argIgnore) {
  for (TestbedSetting setting : argSettings.getSettings()) {
    if (setting.settingsType == argIgnore) {
      continue;
    }
    switch (setting.constraintType) {
      case RANGE:
        Label text = new Label(setting.name + ": " + setting.value);
        Slider slider = new Slider(setting.min, setting.max, setting.value);
        // slider.setMaximumSize(new Dimension(200, 20));
        slider.valueProperty().addListener((prop, oldValue, newValue) -> {
          stateChanged(slider);
        });
        putClientProperty(slider, "name", setting.name);
        putClientProperty(slider, SETTING_TAG, setting);
        putClientProperty(slider, LABEL_TAG, text);
        argPanel.getChildren().add(text);
        argPanel.getChildren().add(slider);
        break;
      case BOOLEAN:
        CheckBox checkbox = new CheckBox(setting.name);
        checkbox.setSelected(setting.enabled);
        checkbox.selectedProperty().addListener((prop, oldValue, newValue) -> {
          stateChanged(checkbox);
        });
        putClientProperty(checkbox, SETTING_TAG, setting);
        argPanel.getChildren().add(checkbox);
        break;
    }
  }
}
 
Example 11
Source File: ShotSectorPane.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public ShotSectorPane(Pane parent, CameraManager cameraManager) {
	final GridPane checkboxGrid = new GridPane();
	sectors = new CheckBox[JavaShotDetector.SECTOR_ROWS][JavaShotDetector.SECTOR_COLUMNS];

	for (int x = 0; x < JavaShotDetector.SECTOR_COLUMNS; x++) {
		for (int y = 0; y < JavaShotDetector.SECTOR_ROWS; y++) {
			final CheckBox sector = new CheckBox();
			sectors[y][x] = sector;
			sector.setSelected(cameraManager.isSectorOn(x, y));

			sector.setOnAction((event) -> {
				cameraManager.setSectorStatuses(getSectorStatuses());
			});

			checkboxGrid.add(sector, x, y);
		}
	}

	final Button doneButton = new Button("Done");

	doneButton.setOnAction((event) -> {
		parent.getChildren().remove(this);
	});

	setTop(checkboxGrid);
	setLeft(doneButton);

	parent.getChildren().add(this);
}
 
Example 12
Source File: PluginManagerPane.java    From Recaf with MIT License 5 votes vote down vote up
private Node createPluginView(BasePlugin plugin) {
	BorderPane pane = new BorderPane();
	pane.setPadding(new Insets(15));
	// Content
	VBox box = new VBox();
	box.setSpacing(10);
	HBox title = new HBox();
	BufferedImage icon = manager.getPluginIcons().get(plugin.getName());
	if (icon != null) {
		IconView iconView = new IconView(UiUtil.toFXImage(icon), 32);
		BorderPane wrapper = new BorderPane(iconView);
		wrapper.setPadding(new Insets(4, 8, 0, 0));
		title.getChildren().add(wrapper);
	}
	title.getChildren().add(new SubLabeled(plugin.getName(), plugin.getDescription()));
	box.getChildren().add(title);
	pane.setCenter(box);
	// Controls
	HBox horizontal = new HBox();
	CheckBox chkEnabled = new CheckBox(LangUtil.translate("misc.enabled"));
	chkEnabled.setSelected(manager.getPluginStates().get(plugin.getName()));
	chkEnabled.selectedProperty()
			.addListener((ob, o, n) -> manager.getPluginStates().put(plugin.getName(), n));
	horizontal.getChildren().add(chkEnabled);
	box.getChildren().add(horizontal);
	return pane;
}
 
Example 13
Source File: Main.java    From ShootOFF with GNU General Public License v3.0 4 votes vote down vote up
private boolean showFirstRunMessage() {
	final Label hardwareMessageLabel = new Label("Fetching hardware status to determine how well ShootOFF\n"
			+ "will run on this machine. This may take a moment...");

	new Thread(() -> {
		final String cpuName = HardwareData.getCpuName();
		final Optional<Integer> cpuScore = HardwareData.getCpuScore();
		final long installedRam = HardwareData.getMegabytesOfRam();

		if (cpuScore.isPresent()) {
			if (logger.isDebugEnabled()) logger.debug("Processor: {}, Processor Score: {}, installed RAM: {} MB",
					cpuName, cpuScore.get(), installedRam);

			Platform.runLater(() -> setHardwareMessage(hardwareMessageLabel, cpuScore.get()));
		} else {
			if (logger.isDebugEnabled()) logger.debug("Processor: {}, installed RAM: {} MB", cpuName, installedRam);

			Platform.runLater(() -> setHardwareMessage(hardwareMessageLabel, installedRam));
		}
	}).start();

	final Alert shootoffWelcome = new Alert(AlertType.INFORMATION);
	shootoffWelcome.setTitle("Welcome to ShootOFF");
	shootoffWelcome.setHeaderText("Please Ensure Your Firearm is Unloaded!");
	shootoffWelcome.setResizable(true);

	final FlowPane fp = new FlowPane();
	final Label lbl = new Label("Thank you for choosing ShootOFF for your training needs.\n"
			+ "Please be careful to ensure your firearm is not loaded\n"
			+ "every time you use ShootOFF. We are not liable for any\n"
			+ "negligent discharges that may result from your use of this\n" + "software.\n\n"
			+ "We upload most errors that cause crashes to our servers to\n"
			+ "help us detect and fix common problems. We do not include any\n"
			+ "personal information in these reports, but you may uncheck\n"
			+ "the box below if you do not want to support this effort.\n\n");
	final CheckBox useErrorReporting = new CheckBox("Allow ShootOFF to Send Error Reports");
	useErrorReporting.setSelected(true);

	fp.getChildren().addAll(hardwareMessageLabel, lbl, useErrorReporting);

	shootoffWelcome.getDialogPane().contentProperty().set(fp);
	shootoffWelcome.showAndWait();

	return useErrorReporting.isSelected();
}
 
Example 14
Source File: PikaRFIDDirectReader.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
private void setClockDialog(){
    Integer localTZ = TimeZone.getDefault().getOffset(System.currentTimeMillis())/3600000;
    Integer ultraTZ = Integer.parseInt(ultraSettings.get("23"));

    // open a dialog box 
    Dialog<Boolean> dialog = new Dialog();
    dialog.setTitle("Set Ultra Clock");
    dialog.setHeaderText("Set the clock for " + ultraIP);
    ButtonType setButtonType = new ButtonType("Set", ButtonBar.ButtonData.OK_DONE);
    dialog.getDialogPane().getButtonTypes().addAll(setButtonType, ButtonType.CANCEL);
    
    VBox clockVBox = new VBox();
    clockVBox.setStyle("-fx-font-size: 16px;");
    
    CheckBox useComputer = new CheckBox("Sync with the local computer");
    VBox manualVBox = new VBox();
    manualVBox.setSpacing(5.0);
    manualVBox.disableProperty().bind(useComputer.selectedProperty());
    
    HBox dateHBox = new HBox();
    dateHBox.setSpacing(5.0);
    Label dateLabel = new Label("Date:");
    dateLabel.setMinWidth(40);
    DatePicker ultraDate = new DatePicker();
    dateHBox.getChildren().addAll(dateLabel,ultraDate);
    
    HBox timeHBox = new HBox();
    timeHBox.setSpacing(5.0);
    Label timeLabel = new Label("Time:");
    timeLabel.setMinWidth(40);
    TextField ultraTime = new TextField();
    timeHBox.getChildren().addAll(timeLabel,ultraTime);
    
    HBox tzHBox = new HBox();
    tzHBox.setSpacing(5.0);
    Label tzLabel = new Label("TimeZone:");
    tzLabel.setMinWidth(40);
    Spinner<Integer> tzSpinner = new Spinner<>(-23, 23, localTZ);    
    tzHBox.getChildren().addAll(tzLabel,tzSpinner);

    manualVBox.getChildren().addAll(dateHBox,timeHBox,tzHBox);
    
    CheckBox autoGPS = new CheckBox("Use GPS to auto-set the clock");
    autoGPS.setSelected(true);

    
    clockVBox.getChildren().addAll(useComputer,manualVBox,autoGPS);
    dialog.getDialogPane().setContent(clockVBox);
    
    BooleanProperty timeOK = new SimpleBooleanProperty(false);

    ultraTime.textProperty().addListener((observable, oldValue, newValue) -> {
        timeOK.setValue(false);
        if (DurationParser.parsable(newValue)) timeOK.setValue(Boolean.TRUE);
        if ( newValue.isEmpty() || newValue.matches("^[0-9]*(:?([0-5]?([0-9]?(:([0-5]?([0-9]?)?)?)?)?)?)?") ){
            System.out.println("Possiblely good start Time (newValue: " + newValue + ")");
        } else {
            Platform.runLater(() -> {
                int c = ultraTime.getCaretPosition();
                if (oldValue.length() > newValue.length()) c++;
                else c--;
                ultraTime.setText(oldValue);
                ultraTime.positionCaret(c);
            });
            System.out.println("Bad clock time (newValue: " + newValue + ")");
        }
    });
    
    
    ultraDate.setValue(LocalDate.now());
    ultraTime.setText(LocalTime.ofSecondOfDay(LocalTime.now().toSecondOfDay()).toString());

    Node createButton = dialog.getDialogPane().lookupButton(setButtonType);
    createButton.disableProperty().bind(timeOK.not());
    
    dialog.setResultConverter(dialogButton -> {
        if (dialogButton == setButtonType) {
            return Boolean.TRUE;
        }
        return null;
    });

    Optional<Boolean> result = dialog.showAndWait();

    if (result.isPresent()) {
        if (useComputer.selectedProperty().get()) {
            System.out.println("Timezone check: Local :" + localTZ + " ultra: " + ultraTZ);
            if (localTZ.equals(ultraTZ)) setClock(LocalDateTime.now(),null,autoGPS.selectedProperty().get());
            else setClock(LocalDateTime.now(),localTZ,autoGPS.selectedProperty().get());
        } else {
            LocalTime time = LocalTime.MIDNIGHT.plusSeconds(DurationParser.parse(ultraTime.getText()).getSeconds());
            Integer newTZ = tzSpinner.getValue();
            if (newTZ.equals(ultraTZ)) setClock(LocalDateTime.of(ultraDate.getValue(), time),null,autoGPS.selectedProperty().get());
            else {
                setClock(LocalDateTime.of(ultraDate.getValue(), time),newTZ,autoGPS.selectedProperty().get());
            }
        }
        
    }
}
 
Example 15
Source File: SelectSongsDialog.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Set the songs to be shown in the dialog.
 * <p/>
 * @param songs the list of songs to be shown.
 * @param checkList a list corresponding to the song list - each position is
 * true if the checkbox should be selected, false otherwise.
 * @param defaultVal the default value to use for the checkbox if checkList
 * is null or smaller than the songs list.
 */
public void setSongs(final List<SongDisplayable> songs, final Map<SongDisplayable, Boolean> checkList, final boolean defaultVal) {
    this.songs = songs;
    gridPane.getChildren().clear();
    checkBoxes.clear();
    gridPane.getColumnConstraints().add(new ColumnConstraints(20));
    ColumnConstraints titleConstraints = new ColumnConstraints();
    titleConstraints.setHgrow(Priority.ALWAYS);
    titleConstraints.setPercentWidth(50);
    gridPane.getColumnConstraints().add(titleConstraints);
    ColumnConstraints authorConstraints = new ColumnConstraints();
    authorConstraints.setHgrow(Priority.ALWAYS);
    authorConstraints.setPercentWidth(45);
    gridPane.getColumnConstraints().add(authorConstraints);

    Label titleHeader = new Label(LabelGrabber.INSTANCE.getLabel("title.label"));
    titleHeader.setAlignment(Pos.CENTER);
    Label authorHeader = new Label(LabelGrabber.INSTANCE.getLabel("author.label"));
    authorHeader.setAlignment(Pos.CENTER);
    gridPane.add(titleHeader, 1, 0);
    gridPane.add(authorHeader, 2, 0);

    for(int i = 0; i < songs.size(); i++) {
        SongDisplayable song = songs.get(i);
        CheckBox checkBox = new CheckBox();
        checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() {

            @Override
            public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
                checkEnableButton();
            }
        });
        if(checkList != null) {
            final Boolean result = checkList.get(song);
            if(result!=null) {
                checkBox.setSelected(!result);
            }
        }
        checkBoxes.add(checkBox);
        gridPane.add(checkBox, 0, i + 1);
        gridPane.add(new Label(song.getTitle()), 1, i + 1);
        gridPane.add(new Label(song.getAuthor()), 2, i + 1);
    }

    for(int i = 0; i < 2; i++) {
        Node n = gridPane.getChildren().get(i);
        if(n instanceof Control) {
            Control control = (Control) n;
            control.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
            control.setStyle("-fx-alignment: center;-fx-font-weight: bold;");
        }
        if(n instanceof Pane) {
            Pane pane = (Pane) n;
            pane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
            pane.setStyle("-fx-alignment: center;-fx-font-weight: bold;");
        }
    }
    gridScroll.setVvalue(0);
    checkEnableButton();
}
 
Example 16
Source File: BrowserTab.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public void addSilent() {
    silent = new CheckBox("Silent");
    silent.setSelected(BrowserConfig.instance().getValue(getBrowserName(), "webdriver-silent", true));
    advancedPane.addFormField("", silent);
}
 
Example 17
Source File: EditAxis.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
private Pane getLogCheckBoxes(final Axis axis) {
    final Pane boxMax = new VBox();
    VBox.setVgrow(boxMax, Priority.ALWAYS);

    final CheckBox logAxis = new CheckBox("log axis");
    HBox.setHgrow(logAxis, Priority.ALWAYS);
    VBox.setVgrow(logAxis, Priority.ALWAYS);
    logAxis.setMaxWidth(Double.MAX_VALUE);
    logAxis.setSelected(axis.isLogAxis());
    boxMax.getChildren().add(logAxis);

    if (axis instanceof DefaultNumericAxis) {
        logAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).logAxisProperty());
    } else {
        // TODO: consider adding an interface on whether log/non-log
        // is editable
        logAxis.setDisable(true);
    }

    final CheckBox invertedAxis = new CheckBox("inverted");
    HBox.setHgrow(invertedAxis, Priority.ALWAYS);
    VBox.setVgrow(invertedAxis, Priority.ALWAYS);
    invertedAxis.setMaxWidth(Double.MAX_VALUE);
    invertedAxis.setSelected(axis.isInvertedAxis());
    boxMax.getChildren().add(invertedAxis);

    if (axis instanceof DefaultNumericAxis) {
        invertedAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).invertAxisProperty());
    } else {
        // TODO: consider adding an interface on whether
        // invertedAxis is editable
        invertedAxis.setDisable(true);
    }

    final CheckBox timeAxis = new CheckBox("time axis");
    HBox.setHgrow(timeAxis, Priority.ALWAYS);
    VBox.setVgrow(timeAxis, Priority.ALWAYS);
    timeAxis.setMaxWidth(Double.MAX_VALUE);
    timeAxis.setSelected(axis.isTimeAxis());
    boxMax.getChildren().add(timeAxis);

    if (axis instanceof DefaultNumericAxis) {
        timeAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).timeAxisProperty());
    } else {
        // TODO: consider adding an interface on whether
        // timeAxis is editable
        timeAxis.setDisable(true);
    }

    return boxMax;
}
 
Example 18
Source File: SettingsController.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
private void initialiseField(final CheckBox field, final BooleanSupplier settingGetter) {
    boolean value = settingGetter.getAsBoolean();

    field.setSelected(value);
}
 
Example 19
Source File: TopsoilPlotWetherill.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
@Override
public List<Node> toolbarControlsFactory() {
    List<Node> controls = super.toolbarControlsFactory();

    CheckBox ellipsesCheckBox = new CheckBox("Ellipses");
    ellipsesCheckBox.setSelected(true);
    ellipsesCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(ELLIPSES, ellipsesCheckBox.isSelected());
    });
    
    ChoiceBox<SigmaPresentationModes> uncertaintyChoiceBox = new ChoiceBox<>(FXCollections.observableArrayList(SigmaPresentationModes.values()));
    uncertaintyChoiceBox.setValue(SigmaPresentationModes.TWO_SIGMA_ABSOLUTE);
    uncertaintyChoiceBox.setConverter(new StringConverter<SigmaPresentationModes>() {
        @Override
        public String toString(SigmaPresentationModes object) {
            return object.getDisplayName();
        }

        @Override
        public SigmaPresentationModes fromString(String string) {
            return null;
        }
    });
    uncertaintyChoiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SigmaPresentationModes>() {
        @Override
        public void changed(ObservableValue observable, SigmaPresentationModes oldValue, SigmaPresentationModes newValue) {
            plot.setProperty(UNCERTAINTY, newValue.getSigmaMultiplier());
        }
    });

    ColorPicker ellipsesColorPicker = new ColorPicker(Color.RED);
    ellipsesColorPicker.setStyle("-fx-font-size: 8px; -fx-font-family: 'Courier New';");
    ellipsesColorPicker.setPrefWidth(100);
    ellipsesColorPicker.setOnAction(mouseEvent -> {
        // to satisfy D3
        plot.setProperty(ELLIPSE_FILL_COLOR, ellipsesColorPicker.getValue().toString().substring(0, 8).replaceAll("0x", "#"));
    });

    CheckBox concordiaLineCheckBox = new CheckBox("Concordia");
    concordiaLineCheckBox.setSelected(true);
    concordiaLineCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(CONCORDIA_LINE, concordiaLineCheckBox.isSelected());
    });

    CheckBox allSelectedCheckBox = new CheckBox("Select All");
    allSelectedCheckBox.setSelected(true);
    allSelectedCheckBox.setOnAction(mouseEvent -> {
        setSelectedAllData(allSelectedCheckBox.isSelected());
    });

    CheckBox regressionUnctEnvelopeCheckBox = new CheckBox("2D Regression Unct");
    regressionUnctEnvelopeCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(REGRESSION_ENVELOPE, regressionUnctEnvelopeCheckBox.isSelected());
    });

    CheckBox regressionCheckBox = new CheckBox("2D Regression");
    regressionCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setDisable(true);
    regressionCheckBox.setOnAction(mouseEvent -> {
        boolean isRegression = regressionCheckBox.isSelected();
        plot.setProperty(REGRESSION_LINE, isRegression);
        regressionUnctEnvelopeCheckBox.setDisable(!isRegression);
    });

    controls.add(ellipsesCheckBox);
    controls.add(uncertaintyChoiceBox);
    controls.add(ellipsesColorPicker);
    controls.add(allSelectedCheckBox);
    controls.add(concordiaLineCheckBox);
    controls.add(regressionCheckBox);
    controls.add(regressionUnctEnvelopeCheckBox);

    return controls;
}
 
Example 20
Source File: BrowserTab.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public void addAlwaysLoadNoFocusLib() {
    alwaysLoadNoFocusLib = new CheckBox("Always Load No Focus Library (Linux)");
    alwaysLoadNoFocusLib
            .setSelected(BrowserConfig.instance().getValue(getBrowserName(), "browser-always-load-no-focus-lib", false));
    advancedPane.addFormField("", alwaysLoadNoFocusLib);
}