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


Java Color类代码示例

本文整理汇总了Java中javafx.scene.paint.Color的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: drawYValueBox

import javafx.scene.paint.Color; //导入依赖的package包/类
@Override
public void drawYValueBox() {
    if (showMouseHoverIndicator.getValue()){
        double y = mouseY.getValue();
        y = y - 10;
        double x = 0;
        double wd = 150;
        double ht = 18;
        if (mouseY == null) {
            return;
        }
        int yIntPos = (int)Math.round(mouseY.getValue());
        Float yValue = this.getValueByYPos(yIntPos);
        if ( yValue != null && yValue != 0){
            String strVolume = String.format("%.2f", yValue);
            GraphicsContext gc = getGraphicsContext2D();
            gc.setFill(Color.web("#010a23"));
            gc.fillRect(x, y, wd, ht);
            gc.setFill(Color.web("#4bf221"));
            gc.fillText(strVolume, x + 13, y+13);
        }
    }
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:24,代码来源:RSDYCanvas.java

示例2: start

import javafx.scene.paint.Color; //导入依赖的package包/类
@Override
	public void start(Stage stage) {
		stage.setTitle("Vokabeltrainer");
        Scene scene = new Scene(new VBox(), 400, 350);
        scene.setFill(Color.OLDLACE);
 
        MenuBar menuBar = new MenuBar();
 
        // --- Menu File
        Menu menuFile = new Menu("Vokabeln");
        
        MenuItem sample = new MenuItem("Sample");
        sample.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
//				Do stuff here
			}
		});
        
        menuFile.getItems().add(sample);
 
        // --- Menu Edit
        Menu menuEdit = new Menu("Abfragemodus");
 
        // --- Menu View
        Menu menuView = new Menu("Statistik");
 
        menuBar.getMenus().addAll(menuFile, menuEdit, menuView);
 
 
        ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
 
        stage.setScene(scene);
        stage.show();
	}
 
开发者ID:dunkelziffer,项目名称:Vokabeltrainer,代码行数:36,代码来源:Main.java

示例3: init

import javafx.scene.paint.Color; //导入依赖的package包/类
@Override public void init() {
    int               noOfValues = 24 * 60;
    LocalDateTime     start      = LocalDateTime.now();
    LocalDateTime     end        = start.plusHours(24);
    List<TYChartItem> tyData1    = new ArrayList<>();

    for (int i = 0 ; i < noOfValues ; i++) {
        tyData1.add(new TYChartItem(start.plusMinutes(i), RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)]));
    }

    tySeries1 = new XYSeries(tyData1, ChartType.LINE, Color.RED, Color.rgb(255, 0, 0, 0.5));
    tySeries1.setSymbolsVisible(false);

    // XYChart
    Converter tempConverter     = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius
    double    tempFahrenheitMin = tempConverter.convert(0, FAHRENHEIT);
    double    tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT);

    xAxisBottom = createBottomTimeAxis(start, end, "HH:mm", true);
    yAxisLeft   = createLeftYAxis(0, 20, true);
    yAxisRight  = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false);
    tyChart     = new XYChart<>(new XYPane(tySeries1), yAxisLeft, yAxisRight, xAxisBottom);
    tyChart.setPrefSize(400, 200);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:25,代码来源:TimeAxisTest.java

示例4: EllipseSample

import javafx.scene.paint.Color; //导入依赖的package包/类
public EllipseSample() {
    super(180,90);
    // Simple red filled ellipse
    Ellipse ellipse1 = new Ellipse(45,45,30,45);
    ellipse1.setFill(Color.RED);
    // Blue stroked ellipse
    Ellipse ellipse2 = new Ellipse(135,45,30,45);
    ellipse2.setStroke(Color.DODGERBLUE);
    ellipse2.setFill(null);
    // Create a group to show all the ellipses);
    getChildren().add(new Group(ellipse1,ellipse2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Ellipse 1 Fill", ellipse1.fillProperty()),
            new SimplePropertySheet.PropDesc("Ellipse 1 Width", ellipse1.radiusXProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Ellipse 1 Height", ellipse1.radiusYProperty(), 10d, 45d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Stroke", ellipse2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Ellipse 2 Stroke Width", ellipse2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Width", ellipse2.radiusXProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Height", ellipse2.radiusYProperty(), 10d, 45d)
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:EllipseSample.java

示例5: createLetter

import javafx.scene.paint.Color; //导入依赖的package包/类
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:KeyStrokeMotion.java

示例6: initialize

import javafx.scene.paint.Color; //导入依赖的package包/类
@FXML
private void initialize() {
    System.out.println("CaptureWindow initialized");
    // Scene
    Scene scene = new Scene(stackPane, screenWidth, screenHeight, Color.TRANSPARENT);
    setScene(scene);
    addKeyHandlers();

    mainCanvas.setWidth(screenWidth);
    mainCanvas.setHeight(screenHeight);

    mainCanvas.setOnMousePressed(m -> {
        xFrom = (int) m.getSceneX();
        yFrom = (int) m.getScreenY();
    });

    mainCanvas.setOnMouseDragged(m -> {
        xNow = (int) m.getScreenX();
        yNow = (int) m.getScreenY();
        repaintCanvas();
    });

    gc = mainCanvas.getGraphicsContext2D();
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:25,代码来源:CaptureWindowController.java

示例7: simpleScene

import javafx.scene.paint.Color; //导入依赖的package包/类
private Scene simpleScene() {
  try {
    VBox root = new VBox();
    Pane pane = new Pane();
    Rectangle rectangle = new Rectangle(100, 100, Color.AQUA);
    pane.getChildren().addAll(rectangle);
    VerticalResizeContainerController controller = new VerticalResizeContainerController(pane);
    root.getChildren().addAll(controller.getView());
    VBox.setVgrow(controller.getView(), Priority.ALWAYS);
    Scene scene = new Scene(root, 800, 600);
    return scene;
  } catch (Exception e) {
    e.printStackTrace();
    return null;
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:17,代码来源:VerticalResizeContainerControllerDemo.java

示例8: updateItem

import javafx.scene.paint.Color; //导入依赖的package包/类
@Override
public void updateItem(Number item, boolean empty) {
    super.updateItem(item, empty);
    
    // format the number as if it were a monetary value using the 
    // formatting relevant to the current locale. This would format
    // 43.68 as "$43.68", and -23.67 as "($23.67)"
    setText(item == null ? "" : NumberFormat.getCurrencyInstance().format(item));

    if (item != null) {
        double value = item.doubleValue();
       
        setTextFill(value == 0 ? Color.BLACK :                  
            value < 0 ? Color.RED : Color.GREEN);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:ListViewCellFactorySample.java

示例9: init

import javafx.scene.paint.Color; //导入依赖的package包/类
private static void init() {
    root = new Group();
    s = new Scene(root, SCENE_WIDTH, SCENE_HEIGHT);
    c = new Canvas(CANVAS_WIDTH, CANVAS_HEIGHT);
    root.getChildren().add(c);
    gc = c.getGraphicsContext2D();
    gc.setStroke(Color.BLUE);
    gc.setLineWidth(2);
    gc.setFill(Color.BLUE);
    Renderer.init();
    GameLoop.start(gc);

    //Initialize Objects
    Player p = new Player();
    setPlayer(p);
    
    //load map
    loadMap();

    //should be called at last it based on player
    EventHandler.attachEventHandlers(s);

}
 
开发者ID:ashish2199,项目名称:Aidos,代码行数:24,代码来源:Sandbox.java

示例10: start

import javafx.scene.paint.Color; //导入依赖的package包/类
@Override 
public void start(Stage stage) 
{
    // create the scene
    stage.setTitle("Social Network");
    scene = new Scene(new Browser(),750,500, Color.web("#666970"));
    stage.setScene(scene);
    scene.getStylesheets().add("webviewsample/BrowserToolbar.css");        
    stage.show();
}
 
开发者ID:ksg14,项目名称:duncan,代码行数:11,代码来源:WatchYoutube.java

示例11: RotateTransitionSample

import javafx.scene.paint.Color; //导入依赖的package包/类
public RotateTransitionSample() {
    super(140,140);

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    getChildren().add(rect);
   
    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:RotateTransitionSample.java

示例12: FadeTransitionSample

import javafx.scene.paint.Color; //导入依赖的package包/类
public FadeTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);
    
    fadeTransition = FadeTransitionBuilder.create()
        .duration(Duration.seconds(4))
        .node(rect)
        .fromValue(1)
        .toValue(0.2)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:FadeTransitionSample.java

示例13: addColorsPane

import javafx.scene.paint.Color; //导入依赖的package包/类
private void addColorsPane() {
    colorPickers.add(colorOne);
    colorPickers.add(colorTwo);
    colorPickers.add(colorThree);
    colorPickers.add(colorFour);
    colorPickers.add(colorFive);
    
    // Get the colors from the database, so the colorpickers can be set
    // to those colors.
    String[] colors = Database.INSTANCE.getColorsFromDatabase();
    for (int i = 0; i < colorPickers.size(); i++) {
        colorPickers.get(i).getStyleClass().add("button");
        // Set the color in the database on the color picker.
        colorPickers.get(i).setValue(Color.web(colors[i]));
    }
}
 
开发者ID:deltadak,项目名称:plep,代码行数:17,代码来源:SlidingSettingsPane.java

示例14: drawConner

import javafx.scene.paint.Color; //导入依赖的package包/类
/**
 * 设置图形节点为选中样式
 */
@Override
public void drawConner() {
    canvas.setMouseTransparent(true);
    isConnerShow = true;

    GraphicsContext gc = canvas.getGraphicsContext2D();
    double whiteR = 12;
    double blueR = 10;

    if (x1 != null) {
        double X = x.doubleValue();
        double Y = y.doubleValue();

        gc.setFill(Color.WHITE);
        gc.fillOval(x1.doubleValue() -6+ X, y1.doubleValue() -6+ Y, whiteR, whiteR);
        gc.fillOval(x2.doubleValue() - 6+ X, y2.doubleValue() - 6 + Y, whiteR, whiteR);

        gc.setFill(Color.color(0.03, 0.43, 0.81));
        gc.fillOval(x1.doubleValue() -5 + X, y1.doubleValue() -5 + Y, blueR, blueR);
        gc.fillOval(x2.doubleValue()-5+ X, y2.doubleValue() - 5 + Y, blueR, blueR);
    }


}
 
开发者ID:xfangfang,项目名称:PhotoScript,代码行数:28,代码来源:DragBoxWithLine.java

示例15: ladder

import javafx.scene.paint.Color; //导入依赖的package包/类
/**
 * Get the color at the give {@code position} in the ladder of color stops
 */
private static Color ladder(final double position, final Stop[] stops) {
    Stop prevStop = null;
    for (int i=0; i<stops.length; i++) {
        Stop stop = stops[i];
        if(position <= stop.getOffset()){
            if (prevStop == null) {
                return stop.getColor();
            } else {
                return interpolateLinear((position-prevStop.getOffset())/(stop.getOffset()-prevStop.getOffset()), prevStop.getColor(), stop.getColor());
            }
        }
        prevStop = stop;
    }
    // position is greater than biggest stop, so will we biggest stop's color
    return prevStop.getColor();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:HeatTabController.java


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