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


Java ColorPicker.setValue方法代码示例

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


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

示例1: marathon_select

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Override public boolean marathon_select(String value) {
    ColorPicker colorPicker = (ColorPicker) getComponent();
    if (!value.equals("")) {
        try {
            colorPicker.setValue(Color.valueOf(value));
            Event.fireEvent(colorPicker, new ActionEvent());
            return true;
        } catch (Throwable t) {
            throw new IllegalArgumentException("Invalid value for '" + value + "' for color-picker '");
        }
    }
    return false;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JavaFXColorPickerElement.java

示例2: reload

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
    super.reload();
    final ColorPicker colorPicker = getColorPicker();
    colorPicker.setValue(UIUtils.from(getPropertyValue()));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:8,代码来源:ColorPropertyEditorControl.java

示例3: reload

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Override
public void reload() {

    final ColorInfluencerControl control = getControl();
    final ColorInfluencer influencer = control.getInfluencer();

    final ColorRGBA newColor = influencer.getColor(getIndex());

    final float red = min(newColor.getRed(), 1F);
    final float green = min(newColor.getGreen(), 1F);
    final float blue = min(newColor.getBlue(), 1F);
    final float alpha = min(newColor.getAlpha(), 1F);

    final ColorPicker colorPicker = getEditableControl();
    colorPicker.setValue(new Color(red, green, blue, alpha));

    super.reload();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:ColorInterpolationElement.java

示例4: shouldConfigureColorPickerWithProperty

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Test public void shouldConfigureColorPickerWithProperty(){
   ObjectProperty< Color > property = new SimpleObjectProperty<>( Color.BLACK );
   ColorPicker picker = new ColorPicker( Color.RED );
   
   systemUnderTest.configureColorPicker( picker, property );
   assertThat( picker.getMaxWidth(), is( Double.MAX_VALUE ) );
   assertThat( picker.getValue(), is( Color.BLACK ) );
   
   property.set( Color.YELLOW );
   assertThat( picker.getValue(), is( Color.YELLOW ) );
   
   picker.setValue( Color.PURPLE );
   assertThat( property.get(), is( Color.PURPLE ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:15,代码来源:JavaFxStyleTest.java

示例5: buildRoadPanel

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void buildRoadPanel() {
	roadAttributes = new VBox();

	roadColorLabel = new Label("Color");
	roadColorLabel.setTextFill(Paint.valueOf("#bfbfbf"));

	roadColorPicker = new ColorPicker();
	roadColorPicker.setValue(Color.BLACK);

	roadWidthLabel = new Label("Pixel Width : ");
	roadWidthLabel.setAlignment(Pos.CENTER);
	roadWidthLabel.setPrefSize(202, 17.0); 
	roadWidthLabel.setTextFill(Paint.valueOf("#e8e5e5"));

	roadWidthSlider = new Slider();
	roadWidthSlider.setBlockIncrement(3);
	roadWidthSlider.setPrefSize(202, 5.0); 

	roadAttributes.getChildren().addAll(roadColorLabel, roadColorPicker, roadWidthLabel, roadWidthSlider);

   	road = new TitledPane("Road", roadAttributes);
   	road.setStyle("-fx-background-color: rgba(0,0,0,0.85);");
   	road.prefWidthProperty().bind(widthProperty());
   	road.setExpanded(false);

       roadWidthSlider.valueProperty().addListener((ObservableValue<? extends Number> ov, Number t, Number t1) -> {
       	roadWidthLabel.setText("Pixel Width : " + t1.intValue());
       });
	
}
 
开发者ID:sanke69,项目名称:eDigitalWorld,代码行数:31,代码来源:RightPanel.java

示例6: buildBuildingPanel

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void buildBuildingPanel() {
	buildingAttributes = new VBox();

	buildingColorLabel = new Label("Color");
	buildingColorLabel.setTextFill(Paint.valueOf("#bfbfbf"));

	buildingColorPicker = new ColorPicker();
	buildingColorPicker.setValue(Color.BLACK);

	buildingWidthLabel = new Label("Pixel Width : ");
	buildingWidthLabel.setAlignment(Pos.CENTER);
	buildingWidthLabel.setPrefSize(202, 17.0); 
	buildingWidthLabel.setTextFill(Paint.valueOf("#e8e5e5"));

	buildingWidthSlider = new Slider();
	buildingWidthSlider.setBlockIncrement(3);
	buildingWidthSlider.setPrefSize(202, 5.0); 

	buildingAttributes.getChildren().addAll(buildingColorLabel, buildingColorPicker, buildingWidthLabel, buildingWidthSlider);

   	building = new TitledPane("Buildings", buildingAttributes);
   	building.setStyle("-fx-background-color: rgba(0,0,0,0.85);");
   	building.prefWidthProperty().bind(widthProperty());
   	building.setExpanded(false);

   	buildingWidthSlider.valueProperty().addListener((ObservableValue<? extends Number> ov, Number t, Number t1) -> {
       	buildingWidthLabel.setText("Pixel Width : " + t1.intValue());
       });
}
 
开发者ID:sanke69,项目名称:eDigitalWorld,代码行数:30,代码来源:RightPanel.java

示例7: buildReliefPanel

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void buildReliefPanel() {
	reliefAttributes = new VBox();

	reliefColorLabel = new Label("Color");
	reliefColorLabel.setTextFill(Paint.valueOf("#bfbfbf"));

	reliefColorPicker = new ColorPicker();
	reliefColorPicker.setValue(Color.BLACK);

	reliefWidthLabel = new Label("Pixel Width : ");
	reliefWidthLabel.setAlignment(Pos.CENTER);
	reliefWidthLabel.setPrefSize(202, 17.0); 
	reliefWidthLabel.setTextFill(Paint.valueOf("#e8e5e5"));

	reliefWidthSlider = new Slider();
	reliefWidthSlider.setBlockIncrement(3);
	reliefWidthSlider.setPrefSize(202, 5.0); 

	reliefAttributes.getChildren().addAll(reliefColorLabel, reliefColorPicker, reliefWidthLabel, reliefWidthSlider);

   	relief = new TitledPane("Reliefs", reliefAttributes);
   	relief.setStyle("-fx-background-color: rgba(0,0,0,0.85);");
   	relief.prefWidthProperty().bind(widthProperty());
   	relief.setExpanded(false);

   	reliefWidthSlider.valueProperty().addListener((ObservableValue<? extends Number> ov, Number t, Number t1) -> {
   		reliefWidthLabel.setText("Pixel Width : " + t1.intValue());
       });
}
 
开发者ID:sanke69,项目名称:eDigitalWorld,代码行数:30,代码来源:RightPanel.java

示例8: buildPOIPanel

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void buildPOIPanel() {
	poiAttributes = new VBox();

	poiColorLabel = new Label("Color");
	poiColorLabel.setTextFill(Paint.valueOf("#bfbfbf"));

	poiColorPicker = new ColorPicker();
	poiColorPicker.setValue(Color.BLACK);

	poiWidthLabel = new Label("Pixel Width : ");
	poiWidthLabel.setAlignment(Pos.CENTER);
	poiWidthLabel.setPrefSize(202, 17.0); 
	poiWidthLabel.setTextFill(Paint.valueOf("#e8e5e5"));

	poiWidthSlider = new Slider();
	poiWidthSlider.setBlockIncrement(3);
	poiWidthSlider.setPrefSize(202, 5.0); 

	poiAttributes.getChildren().addAll(poiColorLabel, poiColorPicker, poiWidthLabel, poiWidthSlider);

   	poi = new TitledPane("POI", poiAttributes);
   	poi.setStyle("-fx-background-color: rgba(0,0,0,0.85);");
   	poi.prefWidthProperty().bind(widthProperty());
   	poi.setExpanded(false);

   	poiWidthSlider.valueProperty().addListener((ObservableValue<? extends Number> ov, Number t, Number t1) -> {
   		poiWidthLabel.setText("Pixel Width : " + t1.intValue());
       });
}
 
开发者ID:sanke69,项目名称:eDigitalWorld,代码行数:30,代码来源:RightPanel.java

示例9: buildROIPanel

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void buildROIPanel() {
	roiAttributes = new VBox();

	roiColorLabel = new Label("Color");
	roiColorLabel.setTextFill(Paint.valueOf("#bfbfbf"));

	roiColorPicker = new ColorPicker();
	roiColorPicker.setValue(Color.BLACK);

	roiWidthLabel = new Label("Pixel Width : ");
	roiWidthLabel.setAlignment(Pos.CENTER);
	roiWidthLabel.setPrefSize(202, 17.0); 
	roiWidthLabel.setTextFill(Paint.valueOf("#e8e5e5"));

	roiWidthSlider = new Slider();
	roiWidthSlider.setBlockIncrement(3);
	roiWidthSlider.setPrefSize(202, 5.0); 

	roiAttributes.getChildren().addAll(roiColorLabel, roiColorPicker, roiWidthLabel, roiWidthSlider);

   	roi = new TitledPane("ROI", roiAttributes);
   	roi.setStyle("-fx-background-color: rgba(0,0,0,0.85);");
   	roi.prefWidthProperty().bind(widthProperty());
   	roi.setExpanded(false);

   	roiWidthSlider.valueProperty().addListener((ObservableValue<? extends Number> ov, Number t, Number t1) -> {
   		roiWidthLabel.setText("Pixel Width : " + t1.intValue());
       });
}
 
开发者ID:sanke69,项目名称:eDigitalWorld,代码行数:30,代码来源:RightPanel.java

示例10: reload

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
    final ColorPicker colorPicker = getColorPicker();
    colorPicker.setValue(UIUtils.from(getPropertyValue()));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:7,代码来源:ColorPropertyControl.java

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

示例12: assertThatElementsUpdateTheme

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void assertThatElementsUpdateTheme( ObservableMap< BuildResultStatus, Color > map, ColorPicker picker ) {
   picker.setValue( Color.BLANCHEDALMOND );
   assertThat( map.get( status ), is( Color.BLANCHEDALMOND ) );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:5,代码来源:StatusConfigurationPaneTest.java

示例13: setColor

import javafx.scene.control.ColorPicker; //导入方法依赖的package包/类
private void setColor(ColorPicker cpicker, Color color) {
    cpicker.setValue(color);
    cpicker.fireEvent(new ActionEvent(null, cpicker));
}
 
开发者ID:epigenome,项目名称:iTagPlot,代码行数:5,代码来源:MainFormController.java

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