List of usage examples for javafx.scene.shape Rectangle Rectangle
public Rectangle()
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group rectangleGroup = new Group(); Scene scene = new Scene(rectangleGroup, 550, 250); Rectangle rect = new Rectangle(); rect.setWidth(100);/*from w w w.jav a 2 s .co m*/ rect.setHeight(100); rect.setScaleY(2); rectangleGroup.getChildren().add(rect); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group rectangleGroup = new Group(); Scene scene = new Scene(rectangleGroup, 550, 250); Rectangle rect = new Rectangle(); rect.setWidth(100);// www . ja v a 2 s . c o m rect.setHeight(100); rect.setTranslateX(135); rect.setTranslateY(11.0); rectangleGroup.getChildren().add(rect); primaryStage.setScene(scene); primaryStage.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); Rectangle r = new Rectangle(); r.setX(50);//from www . j a v a2s . c o m r.setY(50); r.setWidth(200); r.setHeight(100); root.getChildren().add(r); primaryStage.setScene(scene); primaryStage.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); Rectangle r = new Rectangle(); r.setX(50);/* w w w .ja v a 2s. c om*/ r.setY(50); r.setWidth(200); r.setHeight(100); r.setArcWidth(20); r.setArcHeight(20); root.getChildren().add(r); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group rectangleGroup = new Group(); Scene scene = new Scene(rectangleGroup, 550, 250); Rectangle rect = new Rectangle(); rect.setWidth(100);//from ww w . j a va 2s . c o m rect.setHeight(100); Shear sh = new Shear(); sh.setY(0.4); rect.getTransforms().add(sh); rectangleGroup.getChildren().add(rect); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); final Rectangle rect = new Rectangle(); rect.setWidth(100);//w ww . java 2 s.c om rect.setHeight(100); root.getChildren().add(rect); rect.setOnTouchPressed(new EventHandler<TouchEvent>() { @Override public void handle(TouchEvent event) { if (touchId == -1) { touchId = event.getTouchPoint().getId(); touchx = event.getTouchPoint().getSceneX() - rect.getTranslateX(); touchy = event.getTouchPoint().getSceneY() - rect.getTranslateY(); } event.consume(); } }); rect.setOnTouchReleased(new EventHandler<TouchEvent>() { @Override public void handle(TouchEvent event) { if (event.getTouchPoint().getId() == touchId) { touchId = -1; } event.consume(); } }); rect.setOnTouchMoved(new EventHandler<TouchEvent>() { @Override public void handle(TouchEvent event) { if (event.getTouchPoint().getId() == touchId) { rect.setTranslateX(event.getTouchPoint().getSceneX() - touchx); rect.setTranslateY(event.getTouchPoint().getSceneY() - touchy); } event.consume(); } }); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox box = new VBox(); final Scene scene = new Scene(box, 300, 250); scene.setFill(null);//from www .j a v a 2s. c om // A rectangle filled with a linear gradient with a translucent color. Rectangle rectangle = new Rectangle(); rectangle.setX(50); rectangle.setY(50); rectangle.setWidth(100); rectangle.setHeight(70); LinearGradient cycleGrad = new LinearGradient(50, // start X 50, // start Y 70, // end X 70, // end Y false, // proportional CycleMethod.REFLECT, // cycleMethod new Stop(0f, Color.rgb(21, 25, 0, .784)), new Stop(1.0f, Color.rgb(0, 210, 0, .784))); rectangle.setFill(cycleGrad); box.getChildren().add(rectangle); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { VBox box = new VBox(); final Scene scene = new Scene(box, 300, 250); scene.setFill(null);/*ww w . j a va2 s . c o m*/ // A rectangle filled with a linear gradient with a translucent color. Rectangle rectangle = new Rectangle(); rectangle.setX(50); rectangle.setY(50); rectangle.setWidth(100); rectangle.setHeight(70); LinearGradient linearGrad = new LinearGradient(0, // start X 0, // start Y 0, // end X 1, // end Y true, // proportional CycleMethod.NO_CYCLE, // cycle colors // stops new Stop(0.1f, Color.rgb(25, 200, 0, .4)), new Stop(1.0f, Color.rgb(0, 0, 0, .1))); rectangle.setFill(linearGrad); box.getChildren().add(rectangle); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250); Rectangle r = new Rectangle(); r.setX(10);/*from ww w. j a v a 2 s . c o m*/ r.setY(10); r.setWidth(160); r.setHeight(80); r.setFill(Color.DARKBLUE); Text t = new Text(); t.setText("Bloom!"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); t.setX(25); t.setY(65); g.setCache(true); g.setEffect(new Bloom()); g.getChildren().add(r); g.getChildren().add(t); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("Text Fonts"); Group g = new Group(); Scene scene = new Scene(g, 550, 250, Color.web("0x0000FF", 1.0)); Rectangle r = new Rectangle(); r.setX(10);// www . ja v a2 s . c o m r.setY(10); r.setWidth(160); r.setHeight(80); r.setFill(Color.DARKBLUE); Text t = new Text(); t.setText("Bloom!"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); t.setX(25); t.setY(65); g.setCache(true); g.setEffect(new Bloom()); g.getChildren().add(r); g.getChildren().add(t); primaryStage.setScene(scene); primaryStage.show(); }