List of usage examples for javafx.scene.paint Color RED
Color RED
To view the source code for javafx.scene.paint Color RED.
Click Source Link
From source file:Main.java
private Parent createRoot() { Rectangle node1 = RectangleBuilder.create().x(-150).y(-150).translateZ(-100).width(200).height(200) .fill(Color.RED).build(); Rectangle node2 = RectangleBuilder.create().x(-100).y(-100).width(200).height(200).fill(Color.GREEN) .build();//from w w w. j a v a2 s. c om Rectangle node3 = RectangleBuilder.create().x(-50).y(-50).translateZ(100).width(200).height(200) .fill(Color.BLUE).build(); return GroupBuilder.create().children(node1, node2, node3).translateX(250).translateY(250).build(); }
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 w w.j av a2s.co 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(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); Group g = new Group(); DropShadow ds = new DropShadow(); ds.setOffsetY(3.0);/* ww w . ja va 2 s. co m*/ ds.setColor(Color.color(0.4, 0.4, 0.4)); Ellipse ellipse = new Ellipse(); ellipse.setCenterX(50.0f); ellipse.setCenterY(50.0f); ellipse.setRadiusX(50.0f); ellipse.setRadiusY(25.0f); ellipse.setEffect(ds); FillTransition ft = new FillTransition(Duration.millis(3000), ellipse, Color.RED, Color.BLUE); ft.setAutoReverse(true); ft.play(); g.getChildren().add(ellipse); root.getChildren().add(g); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Split Views"); Group root = new Group(); Scene scene = new Scene(root, 350, 250, Color.WHITE); SplitPane splitPane = new SplitPane(); splitPane.prefWidthProperty().bind(scene.widthProperty()); splitPane.prefHeightProperty().bind(scene.heightProperty()); VBox leftArea = new VBox(10); HBox rowBox = new HBox(20); final Text leftText = TextBuilder.create().text("Left ").translateX(20).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 20)).build(); rowBox.getChildren().add(leftText);/*ww w . j a va 2 s . c o m*/ leftArea.getChildren().add(rowBox); leftArea.setAlignment(Pos.CENTER); SplitPane splitPane2 = new SplitPane(); splitPane2.setOrientation(Orientation.VERTICAL); splitPane2.prefWidthProperty().bind(scene.widthProperty()); splitPane2.prefHeightProperty().bind(scene.heightProperty()); HBox centerArea = new HBox(); final Text upperRight = TextBuilder.create().text("Text").x(100).y(50).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 35)).translateY(50).build(); centerArea.getChildren().add(upperRight); HBox rightArea = new HBox(); final Text lowerRight = TextBuilder.create().text("Lower Right").x(100).y(50).fill(Color.RED) .font(Font.font(null, FontWeight.BOLD, 35)).translateY(50).build(); rightArea.getChildren().add(lowerRight); splitPane2.getItems().add(centerArea); splitPane2.getItems().add(rightArea); splitPane.getItems().add(leftArea); splitPane.getItems().add(splitPane2); ObservableList<SplitPane.Divider> dividers = splitPane.getDividers(); for (int i = 0; i < dividers.size(); i++) { dividers.get(i).setPosition((i + 1.0) / 3); } HBox hbox = new HBox(); hbox.getChildren().add(splitPane); root.getChildren().add(hbox); 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. jav a 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; } }); 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) { TextField fName = new TextField(); TextField lName = new TextField(); TextField salary = new TextField(); Button closeBtn = new Button("Close"); closeBtn.setOnAction(e -> Platform.exit()); fName.getProperties().put("microHelpText", "Enter the first name"); lName.getProperties().put("microHelpText", "Enter the last name"); salary.getProperties().put("microHelpText", "Enter a salary greater than $2000.00."); // The help text node is unmanaged helpText.setManaged(false);// w w w.java 2s . co m helpText.setTextOrigin(VPos.TOP); helpText.setFill(Color.RED); helpText.setFont(Font.font(null, 9)); helpText.setMouseTransparent(true); // Add all nodes to a GridPane GridPane root = new GridPane(); root.add(new Label("First Name:"), 1, 1); root.add(fName, 2, 1); root.add(new Label("Last Name:"), 1, 2); root.add(lName, 2, 2); root.add(new Label("Salary:"), 1, 3); root.add(salary, 2, 3); root.add(closeBtn, 3, 3); root.add(helpText, 4, 3); Scene scene = new Scene(root, 300, 100); // Add a change listener to the scene, so we know when // the focus owner changes and display the micro help scene.focusOwnerProperty().addListener((ObservableValue<? extends Node> value, Node oldNode, Node newNode) -> focusChanged(value, oldNode, newNode)); stage.setScene(scene); stage.setTitle("Showing Micro Help"); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new HBox(20), 400, 100); HBox box = (HBox) scene.getRoot();/*from w w w . j a va2s . c o m*/ final ColorPicker colorPicker = new ColorPicker(); colorPicker.setValue(Color.RED); final Text text = new Text("Color picker:"); text.setFill(colorPicker.getValue()); colorPicker.setOnAction((ActionEvent t) -> { text.setFill(colorPicker.getValue()); }); box.getChildren().addAll(colorPicker, text); 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 w w . jav a 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; } }); 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 Parent createRoot() { Circle node1 = CircleBuilder.create().centerX(-50).centerY(-50).radius(100).fill(Color.RED).build(); node1.translateZProperty().bind(translateZForNode1); final Rotate rotate = RotateBuilder.create().pivotX(0).pivotY(0).pivotZ(0).axis(new Point3D(1, 0, 0)) .build();// ww w . j a va 2 s . c o m rotate.angleProperty().bind(angle); return GroupBuilder.create().children(node1).translateX(250).translateY(250).transforms(rotate).build(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 500, 260); // circles/*from w ww. ja va 2 s. c om*/ Circle redCircle = createCircle(100, 50, 30, Color.RED); Circle blueCircle = createCircle(20, 150, 20, Color.BLUE); Circle greenCircle = createCircle(40, 100, 40, Color.GREEN); Line line1 = connect(redCircle, blueCircle); Line line2 = connect(redCircle, greenCircle); Line line3 = connect(greenCircle, blueCircle); // add the circles root.getChildren().add(redCircle); root.getChildren().add(blueCircle); root.getChildren().add(greenCircle); // add the lines root.getChildren().add(line1); root.getChildren().add(line2); root.getChildren().add(line3); // bring the circles to the front of the lines redCircle.toFront(); blueCircle.toFront(); greenCircle.toFront(); primaryStage.setScene(scene); primaryStage.show(); }