当前位置: 首页>>代码示例>>Java>>正文


Java CheckBox.setOnAction方法代码示例

本文整理汇总了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);
    });
}
 
开发者ID:GwtDomino,项目名称:domino-todolist,代码行数:9,代码来源:TodoItemPanel.java

示例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;
}
 
开发者ID:jfree,项目名称:jfree-fxdemos,代码行数:30,代码来源:ScatterPlot3DFXDemo2.java

示例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;
}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:76,代码来源:TopsoilPlotWetherill.java

示例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);
}
 
开发者ID:dhiogoboza,项目名称:SystemMonitorJFX,代码行数:60,代码来源:MainStage.java


注:本文中的javafx.scene.control.CheckBox.setOnAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。