List of usage examples for javafx.scene.paint Color BLACK
Color BLACK
To view the source code for javafx.scene.paint Color BLACK.
Click Source Link
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Shapes"); Group root = new Group(); Scene scene = new Scene(root, 300, 300, Color.WHITE); Ellipse bigCircle = EllipseBuilder.create().centerX(100).centerY(100).radiusX(50).radiusY(75 / 2) .strokeWidth(3).stroke(Color.BLACK).fill(Color.WHITE).build(); Ellipse smallCircle = EllipseBuilder.create().centerX(100).centerY(100).radiusX(35 / 2).radiusY(25 / 2) .build();/*from www .ja va 2s . c o m*/ Shape shape = Path.subtract(bigCircle, smallCircle); shape.setStrokeWidth(1); shape.setStroke(Color.BLACK); shape.setFill(Color.rgb(255, 200, 0)); DropShadow dropShadow = DropShadowBuilder.create().offsetX(2.0f).offsetY(2.0f) .color(Color.rgb(50, 50, 50, .588)).build(); shape.setEffect(dropShadow); root.getChildren().add(shape); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group root = new Group(); Scene scene = new Scene(root, 550, 250, Color.WHITE); Text text = new Text(50, 50, "JavaFX 2.0 from Java2s.com"); Font monoFont = Font.font("Dialog", 30); text.setFont(monoFont);// w ww . j a va 2 s . co m text.setFill(Color.BLACK); root.getChildren().add(text); Reflection refl = new Reflection(); refl.setFraction(0.8f); text.setEffect(refl); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Shapes"); Group root = new Group(); Scene scene = new Scene(root, 300, 300, Color.WHITE); Path path = new Path(); QuadCurve quad = QuadCurveBuilder.create().startX(50).startY(50).endX(150).endY(50).controlX(125) .controlY(150).translateY(path.getBoundsInParent().getMaxY()).strokeWidth(3).stroke(Color.BLACK) .fill(Color.WHITE).build(); root.getChildren().add(quad);//from ww w .j av a 2s . co m primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Colors"); Group root = new Group(); Scene scene = new Scene(root, 350, 300, Color.WHITE); Ellipse ellipse = new Ellipse(100, 50 + 70 / 2, 50, 70 / 2); RadialGradient gradient1 = RadialGradientBuilder.create().focusAngle(0).focusDistance(.1).centerX(80) .centerY(45).radius(120).proportional(false).cycleMethod(CycleMethod.NO_CYCLE) .stops(new Stop(0, Color.RED), new Stop(1, Color.BLACK)).build(); ellipse.setFill(gradient1);/*from w ww.ja v a2 s . co m*/ root.getChildren().add(ellipse); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
private void addBouncyBall(final Scene scene) { final Circle ball = new Circle(100, 100, 20); RadialGradient gradient1 = new RadialGradient(0, .1, 100, 100, 20, false, CycleMethod.NO_CYCLE, new Stop(0, Color.RED), new Stop(1, Color.BLACK)); ball.setFill(gradient1);/*from ww w . j a v a2s .com*/ final Group root = (Group) scene.getRoot(); root.getChildren().add(ball); }
From source file:Main.java
@Override public void start(Stage stage) { Group g = new Group(); final Scene scene = new Scene(g, 300, 250); scene.setFill(null);/*from w ww . j av a 2 s.c o m*/ Light.Spot light = new Light.Spot(); light.setX(0); light.setY(100); light.setZ(50); light.setPointsAtX(400); light.setPointsAtY(0); light.setPointsAtZ(0); light.setSpecularExponent(2); Lighting l = new Lighting(); l.setLight(light); l.setSurfaceScale(5.0); Text t = new Text(); t.setText("Spot"); t.setFill(Color.RED); t.setFont(Font.font(null, FontWeight.BOLD, 90)); t.setX(10.0); t.setY(10.0); t.setTextOrigin(VPos.TOP); t.setEffect(l); Rectangle r = new Rectangle(); r.setFill(Color.BLACK); g.getChildren().add(r); g.getChildren().add(t); r.setWidth(t.getLayoutBounds().getWidth() + 30); r.setHeight(t.getLayoutBounds().getHeight() + 20); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Shapes"); Group root = new Group(); Scene scene = new Scene(root, 300, 300, Color.WHITE); Path path = new Path(); QuadCurveTo quadCurveTo = new QuadCurveTo(); quadCurveTo.setX(50);/* w ww . ja va 2 s . com*/ quadCurveTo.setY(50); quadCurveTo.setControlX(10); quadCurveTo.setControlY(50); LineTo lineTo1 = new LineTo(); lineTo1.setX(150); lineTo1.setY(150); LineTo lineTo2 = new LineTo(); lineTo2.setX(100); lineTo2.setY(200); LineTo lineTo3 = new LineTo(); lineTo3.setX(350); lineTo3.setY(150); MoveTo moveTo = new MoveTo(); moveTo.setX(50); moveTo.setY(150); path.getElements().add(moveTo); path.getElements().add(quadCurveTo); path.getElements().add(lineTo1); path.getElements().add(lineTo2); path.getElements().add(lineTo3); path.setTranslateY(30); path.setStrokeWidth(3); path.setStroke(Color.BLACK); root.getChildren().add(path); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 200, 200); ComboBox<String> myComboBox = new ComboBox<String>(); myComboBox.getItems().addAll("A", "B", "C", "D", "E"); myComboBox.setCellFactory(new Callback<ListView<String>, ListCell<String>>() { @Override/*from ww w. j ava 2 s.c om*/ public ListCell<String> call(ListView<String> param) { final ListCell<String> cell = new ListCell<String>() { { super.setPrefWidth(100); } @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item); if (item.contains("A")) { setTextFill(Color.RED); } else if (item.contains("B")) { setTextFill(Color.GREEN); } else { setTextFill(Color.BLACK); } } else { setText(null); } } }; return cell; } }); Group root = (Group) scene.getRoot(); root.getChildren().add(myComboBox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("ComboBoxSample"); Scene scene = new Scene(new Group(), 450, 250); ComboBox emailComboBox = new ComboBox(); emailComboBox.getItems().addAll("A", "B", "C", "D", "E"); emailComboBox.setCellFactory(new Callback<ListView<String>, ListCell<String>>() { @Override/*from w ww. j a va 2s .c o m*/ public ListCell<String> call(ListView<String> param) { final ListCell<String> cell = new ListCell<String>() { { super.setPrefWidth(100); } @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item); if (item.contains("A")) { setTextFill(Color.RED); } else if (item.contains("B")) { setTextFill(Color.GREEN); } else { setTextFill(Color.BLACK); } } else { setText(null); } } }; return cell; } }); GridPane grid = new GridPane(); grid.setVgap(4); grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(emailComboBox, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
private FlowPane createTopBanner() { FlowPane topBanner = new FlowPane(); topBanner.setPrefHeight(40);/*from w ww .ja v a2 s. co m*/ Font serif = Font.font("Dialog", 30); Text contactText = new Text("Contacts"); contactText.setFill(Color.BLACK); contactText.setFont(serif); topBanner.getChildren().addAll(contactText); return topBanner; }