javafx.scene.control.CheckBox Java Examples
The following examples show how to use
javafx.scene.control.CheckBox.
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: ErrorDataSetRendererStylingSample.java From chart-fx with Apache License 2.0 | 7 votes |
private Tab getChartTab(XYChart chart) { final ParameterTab pane = new ParameterTab("Chart"); final CheckBox gridVisibleX = new CheckBox(""); gridVisibleX.setSelected(true); chart.horizontalGridLinesVisibleProperty().bindBidirectional(gridVisibleX.selectedProperty()); pane.addToParameterPane("Show X-Grid: ", gridVisibleX); final CheckBox gridVisibleY = new CheckBox(""); gridVisibleY.setSelected(true); chart.verticalGridLinesVisibleProperty().bindBidirectional(gridVisibleY.selectedProperty()); pane.addToParameterPane("Show Y-Grid: ", gridVisibleY); final CheckBox gridOnTop = new CheckBox(""); gridOnTop.setSelected(true); chart.getGridRenderer().drawOnTopProperty().bindBidirectional(gridOnTop.selectedProperty()); pane.addToParameterPane("Grid on top: ", gridOnTop); return pane; }
Example #2
Source File: DataSourceTitledPane.java From constellation with Apache License 2.0 | 6 votes |
public DataSourceTitledPane(final DataAccessPlugin plugin, final ImageView dataSourceIcon, final PluginParametersPaneListener top, final Set<String> globalParamLabels) { this.plugin = plugin; this.top = top; this.globalParamLabels = globalParamLabels; isLoaded = false; enabled = new CheckBox(); label = new Label(plugin.getName(), dataSourceIcon); setGraphic(createTitleBar()); enabled.setDisable(true); final boolean isExpanded = DataAccessPreferences.isExpanded(plugin.getName(), false); createParameters(isExpanded, null); setPadding(Insets.EMPTY); setTooltip(new Tooltip(plugin.getDescription())); }
Example #3
Source File: CheckBoxes.java From marathonv5 with Apache License 2.0 | 6 votes |
public CheckBoxes() { VBox vbox = new VBox(); vbox.setSpacing(10); CheckBox cb1 = new CheckBox("Simple checkbox"); CheckBox cb2 = new CheckBox("Three state checkbox"); cb2.setAllowIndeterminate(true); cb2.setIndeterminate(false); CheckBox cb3 = new CheckBox("Disabled"); cb3.setSelected(true); cb3.setDisable(true); vbox.getChildren().add(cb1); vbox.getChildren().add(cb2); vbox.getChildren().add(cb3); getChildren().add(vbox); }
Example #4
Source File: PaymentMethodForm.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
void fillUpFlowPaneWithCountries(List<CheckBox> checkBoxList, FlowPane flowPane, Country country) { final String countryCode = country.code; CheckBox checkBox = new AutoTooltipCheckBox(countryCode); checkBox.setUserData(countryCode); checkBoxList.add(checkBox); checkBox.setMouseTransparent(false); checkBox.setMinWidth(45); checkBox.setMaxWidth(45); checkBox.setTooltip(new Tooltip(country.name)); checkBox.setOnAction(event -> { if (checkBox.isSelected()) { addAcceptedCountry(countryCode); } else { removeAcceptedCountry(countryCode); } updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }
Example #5
Source File: RoleSelectionTest.java From triplea with GNU General Public License v3.0 | 6 votes |
@ParameterizedTest @ValueSource(booleans = {true, false}) void canToggleResourceModifiers(final boolean checked) { final CheckBox checkBox = mock(CheckBox.class); when(checkBox.isSelected()).thenReturn(checked); final Node node1 = mock(Node.class); final Node node2 = mockNodeInGridPane(0, 2); final Node node3 = mockNodeInGridPane(0, 3); final Node node4 = mockNodeInGridPane(1, 2); final Node node5 = mockNodeInGridPane(1, 3); final GridPane factionGrid = mock(GridPane.class); when(factionGrid.getChildren()) .thenReturn(FXCollections.observableArrayList(node1, node2, node3, node4, node5)); roleSelection.setFactionGrid(factionGrid); roleSelection.setResourceModifierCheckbox(checkBox); roleSelection.toggleResourceModifiers(); verify(node1, never()).setDisable(anyBoolean()); verify(node2, never()).setDisable(anyBoolean()); verify(node3, never()).setDisable(anyBoolean()); verify(node4, never()).setDisable(anyBoolean()); verify(node5).setDisable(!checked); }
Example #6
Source File: WebViewHyperlinkListenerDemo.java From mars-sim with GNU General Public License v3.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { // controls WebView webView = createWebView(); Label urlLabel = createUrlLabel(); CheckBox listenerAttachedBox = createListenerAttachedBox(); CheckBox cancelEventBox = createCancelEventBox(); // listener WebViewHyperlinkListener listener = event -> { showEventOnLabel(event, urlLabel); return cancelEventBox.isSelected(); }; manageListener(webView, listener, listenerAttachedBox.selectedProperty()); // put together VBox box = new VBox(webView, listenerAttachedBox, cancelEventBox, urlLabel); java.net.CookieHandler.setDefault(null); Scene scene = new Scene(box); primaryStage.setScene(scene); primaryStage.show(); }
Example #7
Source File: CMultipleChoiceField.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
@Override public DataElt getDataElt(DataEltType type, String eltname, String objectfieldname) { if (!(type instanceof MultipleChoiceDataEltType)) throw new RuntimeException(String.format( "Only MultipleChoiceDataEltType can be extracted from CMultiChoiceField, but request was %s", type)); MultipleChoiceDataElt< CChoiceFieldValue> multipleelement = new MultipleChoiceDataElt<CChoiceFieldValue>(eltname); for (int i = 0; i < checkboxpanel.size(); i++) { CheckBox thischeckbox = checkboxpanel.get(i); if (thischeckbox.isSelected()) { multipleelement.addChoice(values.get(i)); } } return multipleelement; }
Example #8
Source File: PlotConfigDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private int addTraceContent(final GridPane layout, int row, final Trace<?> trace) { Label label = new Label(trace.getName()); layout.add(label, 5, row); final ColorPicker color = createPicker(trace.getColor()); color.setOnAction(event -> { trace.setColor(color.getValue()); plot.requestUpdate(); }); layout.add(color, 6, row); final CheckBox visible = new CheckBox(Messages.PlotConfigVisible); visible.setSelected(trace.isVisible()); visible.setOnAction(event -> { trace.setVisible(visible.isSelected()); plot.requestUpdate(); }); layout.add(visible, 7, row++); return row; }
Example #9
Source File: BooleanCell.java From Quelea with GNU General Public License v3.0 | 6 votes |
public BooleanCell() { checkBox = new CheckBox(); checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(isEditing()) { commitEdit(newValue == null ? false : newValue); } } }); this.setGraphic(checkBox); this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); this.setEditable(true); }
Example #10
Source File: LayerTreeCell.java From arcgis-runtime-samples-java with Apache License 2.0 | 6 votes |
@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 #11
Source File: TimeEditorFactory.java From constellation with Apache License 2.0 | 6 votes |
@Override protected Node createEditorControls() { final GridPane controls = new GridPane(); controls.setAlignment(Pos.CENTER); controls.setVgap(CONTROLS_DEFAULT_VERTICAL_SPACING); final HBox timeSpinnerContainer = createTimeSpinners(); noValueCheckBox = new CheckBox(NO_VALUE_LABEL); noValueCheckBox.setAlignment(Pos.CENTER); noValueCheckBox.selectedProperty().addListener((v, o, n) -> { hourSpinner.setDisable(noValueCheckBox.isSelected()); minSpinner.setDisable(noValueCheckBox.isSelected()); secSpinner.setDisable(noValueCheckBox.isSelected()); milliSpinner.setDisable(noValueCheckBox.isSelected()); update(); }); controls.addRow(0, timeSpinnerContainer); controls.addRow(1, noValueCheckBox); return controls; }
Example #12
Source File: RFXCheckBoxTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@Test public void getText() throws Throwable { CheckBox checkBox = findCheckbox("Simple checkbox"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(new Runnable() { @Override public void run() { checkBox.setSelected(true); RFXCheckBox rfxCheckBox = new RFXCheckBox(checkBox, null, null, lr); rfxCheckBox.mouseClicked(null); text.add(rfxCheckBox._getText()); } }); new Wait("Waiting for checkbox text") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("Simple checkbox", text.get(0)); }
Example #13
Source File: EditAxis.java From chart-fx with Apache License 2.0 | 6 votes |
private Pane getAutoRangeCheckBoxes(final Axis axis) { final Pane boxMax = new VBox(); VBox.setVgrow(boxMax, Priority.ALWAYS); final CheckBox autoRanging = new CheckBox("auto ranging"); HBox.setHgrow(autoRanging, Priority.ALWAYS); VBox.setVgrow(autoRanging, Priority.ALWAYS); autoRanging.setMaxWidth(Double.MAX_VALUE); autoRanging.setSelected(axis.isAutoRanging()); autoRanging.selectedProperty().bindBidirectional(axis.autoRangingProperty()); boxMax.getChildren().add(autoRanging); final CheckBox autoGrow = new CheckBox("auto grow"); HBox.setHgrow(autoGrow, Priority.ALWAYS); VBox.setVgrow(autoGrow, Priority.ALWAYS); autoGrow.setMaxWidth(Double.MAX_VALUE); autoGrow.setSelected(axis.isAutoGrowRanging()); autoGrow.selectedProperty().bindBidirectional(axis.autoGrowRangingProperty()); boxMax.getChildren().add(autoGrow); return boxMax; }
Example #14
Source File: SelectableTitledPane.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public SelectableTitledPane(String title, Node content) { super(title, content); checkBox = new CheckBox(title); checkBox.selectedProperty(). bindBidirectional(this.expandedProperty()); setExpanded(false); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); setGraphic(checkBox); //setSkin(new TitledPaneSkin(this)); lookup(".arrow"). setVisible(false); lookup(".title"). setStyle("-fx-padding: 0 0 4 -10;" + "-fx-font-color: white;" + "-fx-background-color: black;"); lookup(".content"). setStyle("-fx-background-color: black;" + "-fx-font-color: white;" + "-fx-font-smoothing-type: lcd;" + "-fx-padding: 0.2em 0.2em 0.2em 1.316667em;"); }
Example #15
Source File: ByteObjectEditorFactory.java From constellation with Apache License 2.0 | 6 votes |
@Override protected Node createEditorControls() { final GridPane controls = new GridPane(); controls.setAlignment(Pos.CENTER); controls.setVgap(CONTROLS_DEFAULT_VERTICAL_SPACING); numberField = new TextField(); numberField.textProperty().addListener((o, n, v) -> { update(); }); noValueCheckBox = new CheckBox(NO_VALUE_LABEL); noValueCheckBox.setAlignment(Pos.CENTER); noValueCheckBox.selectedProperty().addListener((v, o, n) -> { numberField.setDisable(noValueCheckBox.isSelected()); update(); }); controls.addRow(0, numberField); controls.addRow(1, noValueCheckBox); return controls; }
Example #16
Source File: ListImageCheckBoxCell.java From MyBox with Apache License 2.0 | 6 votes |
@Override public void updateItem(ImageItem item, boolean empty) { super.updateItem(item, empty); setText(null); if (empty || item == null) { setGraphic(null); return; } try { CheckBox cb = (CheckBox) getGraphic(); cb.setText(null); cb.setGraphic(item.makeNode(imageSize)); } catch (Exception e) { setGraphic(null); } }
Example #17
Source File: CategoryMarkerFXDemo1.java From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License | 6 votes |
public CustomDemoNode(Chart3D chart) { this.chartViewer = new Chart3DViewer(chart); this.chartViewer.addEventHandler(FXChart3DMouseEvent.MOUSE_CLICKED, (FXChart3DMouseEvent event) -> { chartMouseClicked(event); }); this.selectedRowKey = "Apple"; this.selectedColumnKey = "Q4/12"; this.itemLabelCheckBox = new CheckBox("Show item labels?"); this.itemLabelCheckBox.setOnAction(e -> { updateItemSelection(selectedRowKey, selectedColumnKey); chart.setNotify(true); }); setCenter(this.chartViewer); HBox container = new HBox(); container.setAlignment(Pos.CENTER); container.setPadding(new Insets(4.0, 4.0, 4.0, 4.0)); container.getChildren().add(this.itemLabelCheckBox); setBottom(container); }
Example #18
Source File: ShipTablePane.java From logbook-kai with MIT License | 6 votes |
/** * 艦種フィルタのチェックボックス * @return 艦種フィルタのチェックボックス */ private List<CheckBox> typeCheckBox() { return Arrays.asList( this.escort, this.destroyer, this.lightCruiser, this.torpedoCruiser, this.heavyCruiser, this.flyingDeckCruiser, this.seaplaneTender, this.escortCarrier, this.carrier, this.armoredcarrier, this.battleship, this.flyingDeckBattleship, this.submarine, this.carrierSubmarine, this.landingship, this.repairship, this.submarineTender, this.trainingShip, this.supply); }
Example #19
Source File: NumberFormatEditor.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public NumberFormatEditor(PropertySheet.Item parameter) { if (!(parameter instanceof NumberFormatParameter)) throw new IllegalArgumentException(); // HBox properties setSpacing(10); setAlignment(Pos.CENTER_LEFT); this.numFormatParameter = (NumberFormatParameter) parameter; getChildren().add(new Text("Decimals")); decimalsSpinner = new SpinnerAutoCommit<>(1, 20, 3); decimalsSpinner.setPrefWidth(80.0); decimalsSpinner.setEditable(true); getChildren().add(decimalsSpinner); if (numFormatParameter.isShowExponentEnabled()) { exponentCheckbox = new CheckBox("Show exponent"); getChildren().add(exponentCheckbox); } else { exponentCheckbox = null; } }
Example #20
Source File: RFXCheckBoxTest.java From marathonv5 with Apache License 2.0 | 5 votes |
private CheckBox findCheckbox(String text) { Set<Node> checkBox = getPrimaryStage().getScene().getRoot().lookupAll(".check-box"); for (Node node : checkBox) { if (((CheckBox) node).getText().equals(text)) { return (CheckBox) node; } } return null; }
Example #21
Source File: EthernetProtocolView.java From trex-stateless-gui with Apache License 2.0 | 5 votes |
/** * Build custom view */ @Override protected void buildCustomProtocolView() { AnchorPane container = new AnchorPane(); type = new CheckBox("Ethernet Type"); addCheckBox(type, 20, 10); typeField = new TextField(); addInput(typeField, 20, 165, 220); typeField.disableProperty().bind(type.selectedProperty().not()); setContent(container); }
Example #22
Source File: JFXCheckBoxSkin.java From JFoenix with Apache License 2.0 | 5 votes |
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final double labelOffset = getLabelOffset(); final CheckBox checkBox = getSkinnable(); final double boxWidth = snapSize(box.prefWidth(-1)); final double boxHeight = snapSize(box.prefHeight(-1)); final double computeWidth = Math.max(checkBox.prefWidth(-1), checkBox.minWidth(-1)); final double labelWidth = Math.min(computeWidth - boxWidth, w - snapSize(boxWidth)) + labelOffset; final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); final double maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x; if (invalid) { if (checkBox.isIndeterminate()) { playIndeterminateAnimation(true, false); } else if (checkBox.isSelected()) { playSelectAnimation(true, false); } invalid = false; } layoutLabelInArea(xOffset + boxWidth + labelOffset, yOffset, labelWidth, maxHeight, checkBox.getAlignment()); rippler.resize(boxWidth, boxHeight); positionInArea(rippler, xOffset, yOffset, boxWidth, maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos()); }
Example #23
Source File: SwitchController.java From Sword_emulator with GNU General Public License v3.0 | 5 votes |
private void initView() { for (int i = 0; i < 16; i++) { checkBox[i] = new CheckBox(); final int index = i; checkBox[i].setOnAction(event -> { switches.set(index, checkBox[index].isSelected()); machine.setSwitches(switches); }); gridPane.add(checkBox[i], 15 - i, 0); Label label = new Label("" + i); labelPane.add(label, 15 - i, 0); } }
Example #24
Source File: JavaFXCheckBoxElementTest.java From marathonv5 with Apache License 2.0 | 5 votes |
@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 #25
Source File: ShotSectorPane.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
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 #26
Source File: TestbedSidePanel.java From jbox2d with BSD 2-Clause "Simplified" License | 5 votes |
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 #27
Source File: TemplateField.java From pattypan with MIT License | 5 votes |
public VBox getRow() { Region spacer = new Region(); spacer.setMinWidth(20); VBox vb = new VBox(5); HBox hb = new HBox(10); HBox hbCheckbox = new HBox(10); valueText.setText(Settings.getSetting("var-" + name + "-value")); value = Settings.getSetting("var-" + name + "-value"); setSelection(Settings.getSetting("var-" + name + "-selection")); hb.getChildren().addAll(labelElement, buttonYes, buttonConst, buttonNo, spacer, valueText, new Region()); vb.getChildren().add(hb); if (name.equals("date")) { Region r = new Region(); r.setMaxWidth(622); r.setPrefWidth(622); r.setMinWidth(420); r.setMinHeight(30); CheckBox checkbox = new CheckBox(Util.text("choose-columns-exif")); checkbox.setMaxWidth(500); checkbox.setPrefWidth(500); checkbox.setMinWidth(305); checkbox.setSelected(Settings.getSetting("exifDate").equals("true")); checkbox.setOnAction((ActionEvent e) -> { Settings.setSetting("exifDate", checkbox.isSelected() ? "true" : ""); }); hbCheckbox.getChildren().addAll(r, checkbox); vb.getChildren().add(hbCheckbox); } return vb; }
Example #28
Source File: PropertySheet.java From JetUML with GNU General Public License v3.0 | 5 votes |
private Control createBooleanEditor(Property pProperty) { CheckBox checkBox = new CheckBox(); checkBox.setSelected((boolean)pProperty.get()); checkBox.selectedProperty().addListener((pObservable, pOldValue, pNewValue) -> { pProperty.set(pNewValue); aListener.propertyChanged(); }); return checkBox; }
Example #29
Source File: ParetoTest.java From charts with Apache License 2.0 | 5 votes |
private void initParts(){ paretoPanel = new ParetoPanel(createTestData1()); circleColor = new ColorPicker(); circleColor.setValue(Color.BLUE); graphColor = new ColorPicker(); graphColor.setValue(Color.BLACK); fontColor = new ColorPicker(); fontColor.setValue(Color.BLACK); smoothing = new CheckBox("Smoothing"); realColor = new CheckBox("AutoSubColor"); showSubBars = new CheckBox("ShowSubBars"); singeSubBarCentered = new CheckBox("SingleSubBarCenterd"); circleSize = new Slider(1,60,20); valueHeight = new Slider(0,80,20); textHeight = new Slider(0,80,40); barSpacing = new Slider(1,50,5); pathHeight = new Slider(0,80,65); barColors = new ArrayList<>(); backButton = new Button("Back to last layer"); exampeColorTheme = createRandomColorTheme(20); paretoPanel.addColorTheme("example",exampeColorTheme); colorTheme = new ComboBox<>(); colorTheme.getItems().addAll(paretoPanel.getColorThemeKeys()); mainBox = new HBox(); menu = new VBox(); pane = new Pane(); }
Example #30
Source File: SnapshotTreeTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
public PVNameTreeTableCell() { getStyleClass().add("check-box-tree-table-cell"); box = new HBox(); box.setSpacing(5); checkBox = new CheckBox(); nullCheckBox = new CheckBox(); nullCheckBox.setDisable(true); nullCheckBox.setSelected(false); setGraphic(null); }