本文整理匯總了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);
}