本文整理汇总了Java中javafx.scene.control.CheckBox.setOnAction方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setOnAction方法的具体用法?Java CheckBox.setOnAction怎么用?Java CheckBox.setOnAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setOnAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSelector
import javafx.scene.control.CheckBox; //导入方法依赖的package包/类
private void initSelector(boolean done) {
selector = new CheckBox();
selector.setSelected(done);
selector.setOnAction(event -> {
updateStyles(selector.isSelected());
uiHandlers.onItemStateChanged(this);
});
}
示例2: createDemoNode
import javafx.scene.control.CheckBox; //导入方法依赖的package包/类
public static Node createDemoNode() {
XYZDataset dataset = createDataset();
Chart3D chart = createChart(dataset);
Chart3DViewer viewer = new Chart3DViewer(chart);
BorderPane node = new BorderPane();
node.setCenter(viewer);
HBox container = new HBox();
CheckBox checkBox = new CheckBox("Logarithmic Axis?");
checkBox.setSelected(true);
checkBox.setOnAction((e) -> {
XYZPlot plot = (XYZPlot) chart.getPlot();
if (checkBox.isSelected()) {
LogAxis3D logAxis = new LogAxis3D("Y (log scale)");
logAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR);
logAxis.receive(new ChartStyler(chart.getStyle()));
plot.setYAxis(logAxis);
} else {
NumberAxis3D yAxis = new NumberAxis3D("Y");
yAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR);
yAxis.receive(new ChartStyler(chart.getStyle()));
plot.setYAxis(yAxis);
}
});
container.setAlignment(Pos.CENTER);
container.setPadding(new Insets(4.0, 4.0, 4.0, 4.0));
container.getChildren().add(checkBox);
node.setBottom(container);
return node;
}
示例3: toolbarControlsFactory
import javafx.scene.control.CheckBox; //导入方法依赖的package包/类
@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(COLORPICKER_CSS_STYLE_SPECS);
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;
}
示例4: initTabProcesses
import javafx.scene.control.CheckBox; //导入方法依赖的package包/类
private Node initTabProcesses() {
userProcessesList = FXCollections.observableArrayList();
allProcessesList = FXCollections.observableArrayList();
ProcessesUtil.getProcesses(allProcessesList, true);
ProcessesUtil.getProcesses(userProcessesList, false);
TableColumn pidCol = new TableColumn("PID");
TableColumn nameCol = new TableColumn("Nome do processo");
TableColumn userCol = new TableColumn("Usuário");
TableColumn cpuCol = new TableColumn("CPU (%)");
TableColumn memCol = new TableColumn("Memória (%)");
pidCol.setCellValueFactory(
new PropertyValueFactory<>("pid")
);
nameCol.setCellValueFactory(
new PropertyValueFactory<>("readableName")
);
userCol.setCellValueFactory(
new PropertyValueFactory<>("user")
);
cpuCol.setCellValueFactory(
new PropertyValueFactory<>("CPU")
);
memCol.setCellValueFactory(
new PropertyValueFactory<>("MEM")
);
viewProcesses = new TableView();
viewProcesses.setEditable(false);
viewProcesses.getColumns().addAll(pidCol, nameCol, userCol, cpuCol, memCol);
viewProcesses.setItems(userProcessesList);
viewProcesses.setOnMousePressed(mouseEventHandler);
checkBoxAllProcesses = new CheckBox("Processos de todos usuários");
checkBoxAllProcesses.setOnAction(actionEventHandler);
inputFilter = new TextField();
inputFilter.textProperty().addListener(this);
Label labelFilter = new Label("Filtrar:");
labelFilter.setPadding(new Insets(0, 10, 0, 0));
HBox hBoxFilter = new HBox(labelFilter, inputFilter);
hBoxFilter.setAlignment(Pos.BASELINE_RIGHT);
HBox.setHgrow(hBoxFilter, Priority.ALWAYS);
HBox hBoxOptions = new HBox(checkBoxAllProcesses, hBoxFilter);
hBoxOptions.setPrefWidth(prefWidth);
hBoxOptions.setPadding(new Insets(10));
return new VBox(viewProcesses, hBoxOptions);
}