本文整理汇总了Java中javafx.scene.control.CheckBox类的典型用法代码示例。如果您正苦于以下问题:Java CheckBox类的具体用法?Java CheckBox怎么用?Java CheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CheckBox类属于javafx.scene.control包,在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActionSelectAll
import javafx.scene.control.CheckBox; //导入依赖的package包/类
public void onActionSelectAll(ActionEvent ae) {
if (!triggerOnActionSelectAll) {
return;
}
LoggerFacade.getDefault().info(this.getClass(), "On action select all"); // NOI18N
if (!(ae.getSource() instanceof CheckBox)) {
return;
}
final CheckBox checkBox = (CheckBox) ae.getSource();
final Boolean isSelected = checkBox.isSelected();
lvEntities.getItems().stream()
.filter((item) -> (item instanceof CheckBoxListCellModel))
.forEach((item) -> {
final CheckBoxListCellModel model = (CheckBoxListCellModel) item;
model.setSelected(isSelected);
});
}
示例2: processOk
import javafx.scene.control.CheckBox; //导入依赖的package包/类
@Override
@FXThread
protected void processOk() {
final NodeTree<?> nodeTree = getNodeTree();
final TreeNode<?> node = getNode();
final Geometry geometry = (Geometry) node.getElement();
final Mesh newMesh = geometry.getMesh();
final Mesh oldMesh = newMesh.deepClone();
final ComboBox<AlgorithmType> algorithmTypeComboBox = getAlgorithmTypeComboBox();
final AlgorithmType algorithmType = algorithmTypeComboBox.getSelectionModel().getSelectedItem();
if (algorithmType == AlgorithmType.STANDARD) {
final CheckBox splitMirroredCheckBox = getSplitMirroredCheckBox();
TangentGenerator.useStandardGenerator(geometry, splitMirroredCheckBox.isSelected());
} else {
TangentGenerator.useMikktspaceGenerator(geometry);
}
final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());
changeConsumer.execute(new ChangeMeshOperation(newMesh, oldMesh, geometry));
super.processOk();
}
示例3: VBoxSample
import javafx.scene.control.CheckBox; //导入依赖的package包/类
public VBoxSample() {
super(400, 100);
CheckBox cb1 = new CheckBox("Breakfast");
CheckBox cb2 = new CheckBox("Lunch");
CheckBox cb3 = new CheckBox("Dinner");
VBox vboxMeals = new VBox(5);
vboxMeals.getChildren().addAll(cb1, cb2, cb3);
Label label = new Label("Select one or more meals:");
VBox vboxOuter = new VBox(10);
vboxOuter.getChildren().addAll(label, vboxMeals);
vboxOuter.setAlignment(Pos.CENTER_LEFT);
getChildren().add(vboxOuter);
}
示例4: getMessageBar
import javafx.scene.control.CheckBox; //导入依赖的package包/类
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
Text b = FXUIUtils.getIconAsText("close");
b.setOnMouseClicked((e) -> {
JSONObject preferences = Preferences.instance().getSection("display");
preferences.put("_doNotShowMessage", cb.isSelected());
Preferences.instance().save("display");
vbox.getChildren().remove(0);
});
Text t = new Text(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hb.getChildren().addAll(t, spacer, b);
return hb;
}
示例5: setFormConstraints
import javafx.scene.control.CheckBox; //导入依赖的package包/类
private void setFormConstraints(Node field) {
if (field instanceof ISetConstraints) {
((ISetConstraints) field).setFormConstraints(this);
} else if (field instanceof Button) {
_setFormConstraints((Button) field);
} else if (field instanceof TextField) {
_setFormConstraints((TextField) field);
} else if (field instanceof TextArea) {
_setFormConstraints((TextArea) field);
} else if (field instanceof ComboBox<?>) {
_setFormConstraints((ComboBox<?>) field);
} else if (field instanceof ChoiceBox<?>) {
_setFormConstraints((ChoiceBox<?>) field);
} else if (field instanceof CheckBox) {
_setFormConstraints((CheckBox) field);
} else if (field instanceof Spinner<?>) {
_setFormConstraints((Spinner<?>) field);
} else if (field instanceof VBox) {
_setFormConstraints((VBox) field);
} else if (field instanceof Label) {
_setFormConstraints((Label) field);
} else {
LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName());
}
}
示例6: _getValue
import javafx.scene.control.CheckBox; //导入依赖的package包/类
@Override public String _getValue() {
TableCell<?, ?> cell = (TableCell<?, ?>) node;
Node graphic = cell.getGraphic();
JavaFXElement component = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window);
if (graphic != null && component != null) {
if (graphic instanceof CheckBox) {
String cellText = cell.getText() == null ? "" : cell.getText();
return cellText + ":" + component._getValue();
}
return component._getValue();
}
return super._getValue();
}
示例7: getText
import javafx.scene.control.CheckBox; //导入依赖的package包/类
@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));
}
示例8: executionOnNonInstructionMemorySelection
import javafx.scene.control.CheckBox; //导入依赖的package包/类
private Node executionOnNonInstructionMemorySelection( SimulatorSettingDetails settingDetails )
{
HBox hBox = new HBox();
//TODO ensure numerical values only
CheckBox executionOfNonInstructionMemoryCheckBox = new CheckBox("Allow execution of non-instruction memory");
executionOfNonInstructionMemoryCheckBox.setAllowIndeterminate(false);
executionOfNonInstructionMemoryCheckBox
.setSelected(Boolean.valueOf(settingDetails.getAllowExecutionOfNonInstructionMemory()));
allowExecutionOfNonInstructionMemoryModel = executionOfNonInstructionMemoryCheckBox.selectedProperty();
hBox.getChildren().add(executionOfNonInstructionMemoryCheckBox);
return hBox;
}
示例9: zeroOnReadsFromUninitializedMemorySelection
import javafx.scene.control.CheckBox; //导入依赖的package包/类
private Node zeroOnReadsFromUninitializedMemorySelection( SimulatorSettingDetails settingDetails )
{
HBox hBox = new HBox();
//TODO ensure numerical values only
CheckBox zeroOnReadsFromUninitializedMemoryCheckBox =
new CheckBox("Assume zero on reads from uninitialized memory");
zeroOnReadsFromUninitializedMemoryCheckBox.setAllowIndeterminate(false);
zeroOnReadsFromUninitializedMemoryCheckBox
.setSelected(Boolean.valueOf(settingDetails.getAssumeZeroOnReadsFromUninitializedMemory()));
assumeZeroOnReadsFromUninitializedMemoryModel = zeroOnReadsFromUninitializedMemoryCheckBox.selectedProperty();
hBox.getChildren().add(zeroOnReadsFromUninitializedMemoryCheckBox);
return hBox;
}
示例10: buildConfigurationUI
import javafx.scene.control.CheckBox; //导入依赖的package包/类
private Node buildConfigurationUI() {
VBox box = new VBox();
box.setPadding(new Insets(10));
CheckBox cb = new CheckBox(MessageBundle.getInstance().getString("homeTimelineCB"));
cb.selectedProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) -> {
showHomeTimeline = newVal;
});
Label label = new Label(MessageBundle.getInstance().getString("userListLabel") + ":");
ListView<SelectableItem<UserList>> lv = new ListView<>();
lv.setItems(itemList);
lv.setCellFactory(CheckBoxListCell.forListView(item -> item.getSelected()));
VBox.setVgrow(lv, Priority.ALWAYS);
box.getChildren().addAll(cb, label, lv);
showTwitterListSelection();
return box;
}
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:22,代码来源:TwitterPreferencesController.java
示例11: CheckBoxListCell
import javafx.scene.control.CheckBox; //导入依赖的package包/类
public CheckBoxListCell(
final Callback<T, ObservableValue<Boolean>> getSelectedProperty,
final BooleanProperty disableProperty,
final StringConverter<T> converter
) {
this.getStyleClass().add("check-box-list-cell");
setSelectedStateCallback(getSelectedProperty);
setConverter(converter);
checkBox = new CheckBox();
checkBox.disableProperty().bind(disableProperty);
setAlignment(Pos.CENTER_LEFT);
setContentDisplay(ContentDisplay.LEFT);
// by default the graphic is null until the cell stops being empty
setGraphic(null);
}
示例12: CheckBoxControl
import javafx.scene.control.CheckBox; //导入依赖的package包/类
public CheckBoxControl(String name) {
super(name, FlashboardSendableType.CHECKBOX);
checkBox = new CheckBox(name);
checkBox.selectedProperty().addListener((obs, o, n)->{
if(localChange)
return;
synchronized (valueMutex) {
lChanged = true;
value = n.booleanValue();
send[0] = (byte) (value? 1: 0);
}
});
root = new VBox();
root.setAlignment(Pos.CENTER);
root.getChildren().add(checkBox);
}
示例13: processOpen
import javafx.scene.control.CheckBox; //导入依赖的package包/类
@Override
@FXThread
protected void processOpen(@NotNull final ResourceElement element) {
super.processOpen(element);
final ComboBox<String> textureParamNameBox = getTextureParamNameComboBox();
final SingleSelectionModel<String> selectionModel = textureParamNameBox.getSelectionModel();
final String textureParamName = selectionModel.getSelectedItem();
final CheckBox transformBox = getApplyLightingTransformCheckBox();
final AssetManager assetManager = EDITOR.getAssetManager();
final Path file = element.getFile();
final Path assetFile = getAssetFile(file);
if (assetFile == null) {
throw new RuntimeException("AssetFile can't be null.");
}
final Material material = assetManager.loadAsset(new MaterialKey(toAssetPath(assetFile)));
final Consumer<ParticlesMaterial> consumer = getConsumer();
consumer.accept(new ParticlesMaterial(material, textureParamName, transformBox.isSelected()));
}
示例14: showLaneBordersClicked
import javafx.scene.control.CheckBox; //导入依赖的package包/类
/**
* When user interacts with the show lane borders {@link CheckBox}.
*
* @param actionEvent the {@link ActionEvent}
*/
@FXML
void showLaneBordersClicked(final ActionEvent actionEvent) {
settings.addRunnable(() -> {
final boolean newValue = ((CheckBox) actionEvent.getSource()).isSelected();
graphVisualizer.getDisplayBordersProperty().setValue(newValue);
LOGGER.info("Displaying lane borders has now been " + (newValue ? "enabled." : "disabled."));
});
}
示例15: CheckBoxTableCell
import javafx.scene.control.CheckBox; //导入依赖的package包/类
public CheckBoxTableCell() {
this.checkBox = new CheckBox();
this.checkBox.setAlignment(Pos.CENTER);
setAlignment(Pos.CENTER);
setGraphic(checkBox);
}