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


Java ColorPicker.setStyle方法代码示例

本文整理汇总了Java中javafx.scene.control.ColorPicker.setStyle方法的典型用法代码示例。如果您正苦于以下问题:Java ColorPicker.setStyle方法的具体用法?Java ColorPicker.setStyle怎么用?Java ColorPicker.setStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ColorPicker的用法示例。


在下文中一共展示了ColorPicker.setStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HighlightingButtonCell

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
HighlightingButtonCell(final TableView<Highlighting> table) {
	hBox = new HBox();
	
	StackPane paddedFgLabel = new StackPane();
	paddedFgLabel.setPadding(new Insets(1));
	paddedFgLabel.getChildren().add(new Label("FG"));
	
	btnFgColor = new ColorPicker(Color.BLACK); //TODO obtain from main
	btnFgColor.setStyle("-fx-color-label-visible: false ;");
	StackPane paddedFgButton = new StackPane();
	paddedFgButton.setPadding(new Insets(1));
	paddedFgButton.getChildren().add(btnFgColor);
	
	StackPane paddedBgLabel = new StackPane();
	paddedBgLabel.setPadding(new Insets(1));
	paddedBgLabel.getChildren().add(new Label("BG"));
	
	btnBgColor = new ColorPicker(Color.WHITE); //TODO obtain from main
	btnBgColor.setStyle("-fx-color-label-visible: false ;");
	StackPane paddedBgButton = new StackPane();
	paddedBgButton.setPadding(new Insets(1));
	paddedBgButton.getChildren().add(btnBgColor);
	hBox.getChildren().add(paddedFgLabel);
	hBox.getChildren().add(paddedFgButton);
	hBox.getChildren().add(paddedBgLabel);
	hBox.getChildren().add(paddedBgButton);
}
 
开发者ID:bkusche,项目名称:bktail2,代码行数:28,代码来源:HighlightingController.java

示例2: toolbarControlsFactory

import javafx.scene.control.ColorPicker; //导入方法依赖的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

示例3: handle

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Override
        public void handle(final MouseEvent event) {
            // On right click
            if (event.getButton() == MouseButton.SECONDARY) {

                // Create a context menu
                final ContextMenu contextMenu = new ContextMenu();

                // Entry to delete a plug
                final MenuItem deleteMenu = new MenuItem(null, new Label("Delete"));
                deleteMenu.setOnAction(e -> {
                    CoreController.getConnectionManager().deleteCable(cable);
                });

                // Entry to change the color of a plug
                final ColorPicker colorPicker = new ColorPicker();
                colorPicker.setValue(cable.getColor());
                colorPicker.getStyleClass().add("button");
                colorPicker.setStyle("-fx-background-color: transparent;");

                final MenuItem colorMenu = new MenuItem(null, colorPicker);
                colorMenu.setOnAction(e -> cable.setColor(colorPicker.getValue()));

                // Show the context menu
                contextMenu.getItems().addAll(deleteMenu, colorMenu);
                contextMenu.show(cable , event.getScreenX(), event.getScreenY());

                event.consume();
            }
            // FIXME: when managed inside the curvecable, the moving of a cable does not work properly, it creates a new cable after reconnection
            // because of the connection manager which has finished the first connection, so no more current cable and no more cable attached to the plug yet !!!
//            if (event.getButton() == MouseButton.PRIMARY) {
//                if (plugState == PlugState.PLUGGED) {
//                    Point2D clickPoint = new Point2D(event.getSceneX(), event.getSceneY());
//                    Point2D inputPoint = computeCoordinates(inputPlug);
//                    Point2D outputPoint = computeCoordinates(outputPlug);
//                    if (inputPoint.distance(clickPoint) < outputPoint.distance(clickPoint)) {
//                        disconnectInputPlug();
//                    } else {
//                        disconnectOutputPlug();
//                    }
//                    // Then call the connectionManager to give this plug
//                    //CoreController.getConnectionManager().setCurrentCable((CurveCable) event.getSource());
//                    event.consume();
//                }
//            }
        }
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:48,代码来源:CurveCable.java


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