當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorPicker.setOnAction方法代碼示例

本文整理匯總了Java中javafx.scene.control.ColorPicker.setOnAction方法的典型用法代碼示例。如果您正苦於以下問題:Java ColorPicker.setOnAction方法的具體用法?Java ColorPicker.setOnAction怎麽用?Java ColorPicker.setOnAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.ColorPicker的用法示例。


在下文中一共展示了ColorPicker.setOnAction方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handle

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
@Override
public void handle() {				
	Pane root = new Pane();
	Text splash = createText();
	ColorPicker colorPicker = new ColorPicker();
	Circle circle = new Circle(100,100,30);
	circle.setFill(colorPicker.getValue());
	colorPicker.setOnAction(e -> circle.setFill(colorPicker.getValue()));

	Button okayButton = createButton(root, colorPicker);

	root.getChildren().addAll(circle, colorPicker, okayButton, splash);		

	Scene scene = new Scene(root,400,200);
	scene.getStylesheets().setAll(CSS_LOCATION);
	stage.setScene(scene);		
	stage.show();			
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:19,代碼來源:BackgroundSettingMenuHandler.java

示例2: initializeColorPicker

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
private void initializeColorPicker(HBox alignment){
	ColorPicker cp = new ColorPicker();
	c = Color.WHITE;
	cp.setOnAction(e -> {
		c = cp.getValue();
		String rgb = Math.round(c.getRed()*255) + " " + Math.round(c.getGreen()*255) + " " + Math.round(c.getBlue()*255);
    	Tooltip tp = new Tooltip(rgb);
    	Tooltip.install(cp, tp);
	});
	
	alignment.getChildren().add(cp);
    
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:14,代碼來源:ToolPanel.java

示例3: createColorPicker

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
private ColorPicker createColorPicker (String id) {
    ColorPicker colorPicker = new ColorPicker();

    colorPicker.setId(id);
    colorPicker.setOnAction(e -> updateValue(resourceBundle.getString(id),
                                             colorPicker.getValue().toString()));

    return colorPicker;
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:10,代碼來源:Workspace.java

示例4: putColorPicker

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
private ColorPicker putColorPicker () {
    ColorPicker colorPicker = new ColorPicker();
    colorPicker.setOnAction(event -> {
    	colorChosen = colorPicker.getValue();
    });
    return colorPicker;
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:8,代碼來源:ColorPickerStage.java

示例5: createColorPicker

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
/** @param section Segment of the color map
 *  @return ColorPicker that updates this segment in #color_sections
 */
private ColorPicker createColorPicker(final ColorSection section)
{
    final Color color = section.color;
    final int index = color_sections.indexOf(section);
    if (index < 0)
        throw new IllegalArgumentException("Cannot locate color section " + section);
    final ColorPicker picker = new ColorPicker(color);
    picker.setOnAction(event ->
    {
        color_sections.set(index, new ColorSection(section.value, picker.getValue()));
        updateMapFromSections();
    });
    return picker;
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:18,代碼來源:ColorMapDialog.java

示例6: 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

示例7: StrokeProperty

import javafx.scene.control.ColorPicker; //導入方法依賴的package包/類
public StrokeProperty(final GObject gObj, String name, String getter, final String setter, String fxml, String defaultValue, GridPane gp, int row, Node settingsNode, HistoryManager hm) {
    this.gObj = gObj;
    this.node = (Shape)gObj;
    this.historyManager = hm;

    gp.add(new Label("Stroke:"), 0, row);
    gp.add(new Label("Stroke Width:"), 0, row + 1);

    colorPicker = new ColorPicker();
    textField = new TextField();

    Color defaultStrokeColor = Color.LIMEGREEN;
    double defaultStrokeWidth = 0;

    //Grab value from settingsNode if given
    if (settingsNode != null) {
        Color loadedStrokeColor = (Color)((Shape)settingsNode).getStroke();
        if (loadedStrokeColor != null) {
            defaultStrokeColor = loadedStrokeColor;
            defaultStrokeWidth = ((Shape)settingsNode).getStrokeWidth();// Inside IF otherwise loads as width=1 when no width is set
        }
    }

    colorPicker.setValue(defaultStrokeColor);
    textField.setText("" + defaultStrokeWidth);

    setColor();
    setWidth();

    gp.add(colorPicker, 1, row);
    gp.add(textField, 1, row + 1);

    //On action, save to the GObject
    colorPicker.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            setColor();
        }
    });
    textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean aBoolean2) {
            if (!aBoolean2) {
                setWidth();
            }
        }
    });
}
 
開發者ID:JavaFX-GUI-Builder,項目名稱:GUI-Builder,代碼行數:49,代碼來源:StrokeProperty.java


注:本文中的javafx.scene.control.ColorPicker.setOnAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。