javafx.scene.paint.Color#GREEN源码实例Demo

下面列出了javafx.scene.paint.Color#GREEN 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: oim-fx   文件: ColorPickerApp.java
public Parent createContent() {
    final ColorPicker colorPicker = new ColorPicker(Color.GREEN);
    final Label coloredText = new Label("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setTextFill(c);
    coloredButton.setStyle(createRGBString(c));
    
    colorPicker.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent t) {
            Color newColor = colorPicker.getValue();
            coloredText.setTextFill(newColor);
            coloredButton.setStyle(createRGBString(newColor));
        }
    });
    
    VBox outerVBox = new VBox(coloredText, coloredButton, colorPicker);
    outerVBox.setAlignment(Pos.CENTER);
    outerVBox.setSpacing(20);
    outerVBox.setMaxSize(VBox.USE_PREF_SIZE, VBox.USE_PREF_SIZE);
    
    return outerVBox;
}
 
源代码2 项目: games_oop_javafx   文件: CatchBall.java
private List<Circle> generateApples() {
    List<Circle> apples = new ArrayList<>();
    Random rn = new Random();
    for (int i = 0; i < 10; i++) {
        Circle apple = new Circle(10, Color.GREEN);
        apple.relocate(rn.nextInt(500), rn.nextInt(500));
        apples.add(apple);
    }
    return apples;
}
 
源代码3 项目: marathonv5   文件: CubeSample.java
@Override public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
 
源代码4 项目: marathonv5   文件: CubeSample.java
@Override public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
 
源代码5 项目: netbeans   文件: Cube3D.java
public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
 
源代码6 项目: phoebus   文件: StateCell.java
static Color getStateColor(final ScanState state)
{
    switch (state)
    {
    case Idle:      return Color.DARKBLUE;
    case Aborted:   return Color.DARKGOLDENROD;
    case Failed:    return Color.RED;
    case Finished:  return Color.DARKGREEN;
    case Paused:    return Color.GRAY;
    case Running:   return Color.GREEN;
    default:        return Color.BLACK;
    }
}
 
源代码7 项目: charts   文件: LegendTest.java
@Override public void init() {
    LegendItem item1 = new LegendItem(Symbol.CIRCLE, "Item 1", Color.RED, Color.BLACK);
    LegendItem item2 = new LegendItem(Symbol.SQUARE, "Item 2", Color.GREEN, Color.BLACK);
    LegendItem item3 = new LegendItem(Symbol.TRIANGLE, "Item 3", Color.BLUE, Color.BLACK);

    legend = new Legend(item1, item2, item3);
    legend.setOrientation(Orientation.VERTICAL);
}
 
源代码8 项目: ShootOFF   文件: TargetEditorController.java
public static Color createColor(final String name) {
	switch (name) {
	case "black":
		return Color.BLACK;
	case "blue":
		return Color.BLUE;
	case "brown":
		return Color.SADDLEBROWN;
	case "gray":
		return DARK_GRAY;
	case "green":
		return Color.GREEN;
	case "orange":
		return Color.ORANGE;
	case "red":
		return Color.RED;
	case "white":
		return Color.WHITE;
	default:
		if (name.startsWith("#")) {
			try {
				return Color.web(name);
			} catch (IllegalArgumentException e) {
				return Color.CORNSILK;
			}
		} else {
			return Color.CORNSILK;	
		}
	}
}
 
源代码9 项目: metastone   文件: CardToken.java
protected void setScoreValue(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value > baseValue) {
		color = Color.GREEN;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码10 项目: metastone   文件: CardToken.java
protected void setScoreValue(Group group, int value, int baseValue, int maxValue) {
	Color color = Color.WHITE;
	if (value < maxValue) {
		color = Color.RED;
	} else if (value > baseValue) {
		color = Color.GREEN;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码11 项目: metastone   文件: CardToken.java
private void setScoreValueLowerIsBetter(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value < baseValue) {
		color = Color.GREEN;
	} else if (value > baseValue) {
		color = Color.RED;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码12 项目: metastone   文件: GameToken.java
protected void setScoreValue(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value > baseValue) {
		color = Color.GREEN;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码13 项目: metastone   文件: GameToken.java
protected void setScoreValue(Group group, int value, int baseValue, int maxValue) {
	Color color = Color.WHITE;
	if (value < maxValue) {
		color = Color.RED;
	} else if (value > baseValue) {
		color = Color.GREEN;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码14 项目: metastone   文件: GameToken.java
protected void setScoreValueLowerIsBetter(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value < baseValue) {
		color = Color.GREEN;
	} else if (value > baseValue) {
		color = Color.RED;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
源代码15 项目: FXTutorials   文件: Main.java
private Parent createContent() {
    Pane root = new Pane();
    root.setPrefSize(1280, 720);

    info.setTranslateX(50);
    info.setTranslateY(50);

    player = new Entity(400, 400, 30, 60, Color.GREEN);
    enemy = new Entity(300, 300, 40, 40, Color.RED);
    coin = new Entity(300, 400, 20, 20, Color.YELLOW);

    player.setUserData("Player");
    enemy.setUserData("Enemy");
    coin.setUserData("Coin");

    objects.addAll(Arrays.asList(player, enemy, coin));

    registeredCollisions.add(new CollisionPair("Player", "Enemy", () -> {
        info.setText("Got hit by enemy");
    }));

    registeredCollisions.add(new CollisionPair("Player", "Coin", () -> {
        info.setText("Picked up a coin");
    }));

    root.getChildren().addAll(info, player, enemy, coin);
    return root;
}
 
源代码16 项目: FXTutorials   文件: Main.java
private Parent createContent() {
    Pane root = new Pane();
    root.setPrefSize(1280, 720);

    info.setTranslateX(50);
    info.setTranslateY(50);

    player = new Entity(400, 400, 30, 60, Color.GREEN);
    enemy = new Entity(300, 300, 40, 40, Color.RED);

    root.getChildren().addAll(info, player, enemy);
    return root;
}
 
源代码17 项目: logbook-kai   文件: ShipImage.java
/**
 * 補給ゲージ(燃料・弾薬)を取得します
 *
 * @param ship 艦娘
 * @return 補給ゲージ
 */
static Image getSupplyGauge(Ship ship) {
    Canvas canvas = new Canvas(36, 12);
    GraphicsContext gc = canvas.getGraphicsContext2D();

    Optional<ShipMst> mstOpt = Ships.shipMst(ship);
    if (mstOpt.isPresent()) {
        double width = canvas.getWidth();

        ShipMst mst = mstOpt.get();
        double fuelPer = (double) ship.getFuel() / (double) mst.getFuelMax();
        double ammoPer = (double) ship.getBull() / (double) mst.getBullMax();

        gc.setFill(Color.GRAY);
        gc.fillRect(0, 3, width, 2);

        gc.setFill(Color.GRAY);
        gc.fillRect(0, 10, width, 2);

        Color fuelColor = fuelPer >= 0.5D ? Color.GREEN : fuelPer >= 0.4D ? Color.ORANGE : Color.RED;
        Color ammoColor = ammoPer >= 0.5D ? Color.SADDLEBROWN : ammoPer >= 0.4D ? Color.ORANGE : Color.RED;

        gc.setFill(fuelColor);
        gc.fillRect(0, 0, width * fuelPer, 4);

        gc.setFill(ammoColor);
        gc.fillRect(0, 7, width * ammoPer, 4);
    }
    SnapshotParameters sp = new SnapshotParameters();
    sp.setFill(Color.TRANSPARENT);

    return canvas.snapshot(sp, null);
}
 
源代码18 项目: FXTutorials   文件: FroggerApp.java
private Node initFrog() {
    Rectangle rect = new Rectangle(38, 38, Color.GREEN);
    rect.setTranslateY(600 - 39);

    return rect;
}
 
源代码19 项目: FXTutorials   文件: Tutorial.java
private Parent createContent() {
    Cube c = new Cube(1, Color.GREEN);
    c.setTranslateX(-1);
    c.setRotationAxis(Rotate.Y_AXIS);
    c.setRotate(45);

    Cube c2 = new Cube(1, Color.BLUE);
    c2.setTranslateX(1);
    c2.setRotationAxis(Rotate.Y_AXIS);
    c2.setRotate(45);

    Cube c3 = new Cube(1, Color.RED);
    c3.setRotationAxis(Rotate.Y_AXIS);
    c3.setRotate(45);

    camera = new PerspectiveCamera(true);
    translate = new Translate(0, 0, -10);
    rotate = new Rotate(0, new Point3D(0, 1, 0));
    camera.getTransforms().addAll(translate, rotate);

    PointLight light = new PointLight(Color.WHITE);
    light.setTranslateX(3);
    light.setTranslateZ(-5);

    TranslateTransition tt = new TranslateTransition(Duration.seconds(2), light);
    tt.setFromX(-3);
    tt.setToX(3);
    tt.setAutoReverse(true);
    tt.setCycleCount(Animation.INDEFINITE);

    AmbientLight globalLight = new AmbientLight(Color.WHITE.deriveColor(0, 1, 0.2, 1));


    worldRoot.getChildren().addAll(c, c2, c3, globalLight, light);

    SubScene subScene = new SubScene(worldRoot, 800, 600, true, SceneAntialiasing.BALANCED);
    subScene.setCamera(camera);

    tt.play();

    return new Group(new Rectangle(800, 600), subScene);
}