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

The following examples show how to use javafx.scene.control.CheckBox#setText() . 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: 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 2
Source File: ListImageCheckBoxCell.java    From MyBox with Apache License 2.0 6 votes vote down vote up
@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 3
Source File: EditorOptionsPane.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void initComponents() {
	// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
	markersTitle = new Label();
	Label strongEmphasisMarkerLabel = new Label();
	strongEmphasisMarkerField = new ChoiceBox<>();
	Label emphasisMarkerLabel = new Label();
	emphasisMarkerField = new ChoiceBox<>();
	Label bulletListMarkerLabel = new Label();
	bulletListMarkerField = new ChoiceBox<>();
	formatTitle = new Label();
	wrapLineLengthLabel = new Label();
	wrapLineLengthField = new IntSpinner();
	Label wrapLineLengthLabel2 = new Label();
	formatOnSaveCheckBox = new CheckBox();
	formatOnlyModifiedParagraphsCheckBox = new CheckBox();

	//======== this ========
	setLayout("hidemode 3");
	setCols(
		"[indent,fill]0" +
		"[fill]" +
		"[fill]" +
		"[fill]");
	setRows(
		"[]" +
		"[]" +
		"[]" +
		"[]para" +
		"[]" +
		"[]" +
		"[]" +
		"[]");

	//---- markersTitle ----
	markersTitle.setText(Messages.get("EditorOptionsPane.markersTitle.text"));
	add(markersTitle, "cell 0 0 2 1");

	//---- strongEmphasisMarkerLabel ----
	strongEmphasisMarkerLabel.setText(Messages.get("EditorOptionsPane.strongEmphasisMarkerLabel.text"));
	strongEmphasisMarkerLabel.setMnemonicParsing(true);
	add(strongEmphasisMarkerLabel, "cell 1 1");
	add(strongEmphasisMarkerField, "cell 2 1");

	//---- emphasisMarkerLabel ----
	emphasisMarkerLabel.setText(Messages.get("EditorOptionsPane.emphasisMarkerLabel.text"));
	emphasisMarkerLabel.setMnemonicParsing(true);
	add(emphasisMarkerLabel, "cell 1 2");
	add(emphasisMarkerField, "cell 2 2");

	//---- bulletListMarkerLabel ----
	bulletListMarkerLabel.setText(Messages.get("EditorOptionsPane.bulletListMarkerLabel.text"));
	bulletListMarkerLabel.setMnemonicParsing(true);
	add(bulletListMarkerLabel, "cell 1 3");
	add(bulletListMarkerField, "cell 2 3");

	//---- formatTitle ----
	formatTitle.setText(Messages.get("EditorOptionsPane.formatTitle.text"));
	add(formatTitle, "cell 0 4 2 1");

	//---- wrapLineLengthLabel ----
	wrapLineLengthLabel.setText(Messages.get("EditorOptionsPane.wrapLineLengthLabel.text"));
	wrapLineLengthLabel.setMnemonicParsing(true);
	add(wrapLineLengthLabel, "cell 1 5");
	add(wrapLineLengthField, "cell 2 5");

	//---- wrapLineLengthLabel2 ----
	wrapLineLengthLabel2.setText(Messages.get("EditorOptionsPane.wrapLineLengthLabel2.text"));
	add(wrapLineLengthLabel2, "cell 3 5");

	//---- formatOnSaveCheckBox ----
	formatOnSaveCheckBox.setText(Messages.get("EditorOptionsPane.formatOnSaveCheckBox.text"));
	add(formatOnSaveCheckBox, "cell 1 6 2 1,alignx left,growx 0");

	//---- formatOnlyModifiedParagraphsCheckBox ----
	formatOnlyModifiedParagraphsCheckBox.setText(Messages.get("EditorOptionsPane.formatOnlyModifiedParagraphsCheckBox.text"));
	add(formatOnlyModifiedParagraphsCheckBox, "cell 1 7 2 1,alignx left,growx 0");
	// JFormDesigner - End of component initialization  //GEN-END:initComponents

	// TODO set this in JFormDesigner as soon as it supports labelFor
	strongEmphasisMarkerLabel.setLabelFor(strongEmphasisMarkerField);
	emphasisMarkerLabel.setLabelFor(emphasisMarkerField);
	bulletListMarkerLabel.setLabelFor(bulletListMarkerField);
	wrapLineLengthLabel.setLabelFor(wrapLineLengthField);
}