List of usage examples for javafx.scene.shape Rectangle setHeight
public final void setHeight(double value)
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);/*from ww w.jav a 2s. c om*/ 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) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); final Rectangle rect = new Rectangle(); rect.setWidth(100);//from ww w . j a v a 2 s . c o m 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);//w w w . j a va2 s . 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);/*from w w w . j a v a2 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 stage) { Group root = new Group(); Scene scene = new Scene(root, 260, 80); stage.setScene(scene);/*from w ww . j a v a 2 s.c o m*/ Group g = new Group(); PerspectiveTransform pt = new PerspectiveTransform(); pt.setUlx(10.0); pt.setUly(10.0); pt.setUrx(310.0); pt.setUry(40.0); pt.setLrx(310.0); pt.setLry(60.0); pt.setLlx(10.0); pt.setLly(90.0); g.setEffect(pt); g.setCache(true); Rectangle r = new Rectangle(); r.setX(10.0); r.setY(10.0); r.setWidth(280.0); r.setHeight(80.0); r.setFill(Color.BLUE); Text t = new Text(); t.setX(20.0); t.setY(65.0); t.setText("JavaFX"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); g.getChildren().add(r); g.getChildren().add(t); scene.setRoot(g); 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); int w = 220;//from w ww . j a v a 2 s.c o m int h = 100; FloatMap map = new FloatMap(); map.setWidth(w); map.setHeight(h); for (int i = 0; i < w; i++) { double v = (Math.sin(i / 20.0 * Math.PI) - 0.5) / 40.0; for (int j = 0; j < h; j++) { map.setSamples(i, j, 0.0f, (float) v); } } Group g = new Group(); DisplacementMap dm = new DisplacementMap(); dm.setMapData(map); g.setEffect(dm); g.setCache(true); Rectangle r = new Rectangle(); r.setX(20.0); r.setY(20.0); r.setWidth(w); r.setHeight(h); r.setFill(Color.BLUE); g.getChildren().add(r); Text t = new Text(); t.setX(40.0); t.setY(80.0); t.setText("Wavy Text"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); g.getChildren().add(t); root.getChildren().add(g); primaryStage.setScene(scene); primaryStage.show(); }
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);/* ww w . 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) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); Rectangle rect = new Rectangle(); rect.setWidth(100);/*ww w . ja va 2s . com*/ rect.setHeight(100); root.getChildren().add(rect); rect.setOnScroll(new EventHandler<ScrollEvent>() { @Override public void handle(ScrollEvent event) { if (!event.isInertia()) { rect.setTranslateX(rect.getTranslateX() + event.getDeltaX()); rect.setTranslateY(rect.getTranslateY() + event.getDeltaY()); } System.out.println("Rectangle: Scroll event" + ", inertia: " + event.isInertia() + ", direct: " + event.isDirect()); event.consume(); } }); rect.setOnScrollStarted(new EventHandler<ScrollEvent>() { @Override public void handle(ScrollEvent event) { System.out.println("Rectangle: Scroll started event"); event.consume(); } }); rect.setOnScrollFinished(new EventHandler<ScrollEvent>() { @Override public void handle(ScrollEvent event) { System.out.println("Rectangle: Scroll finished event"); event.consume(); } }); rect.setOnZoom(new EventHandler<ZoomEvent>() { @Override public void handle(ZoomEvent event) { rect.setScaleX(rect.getScaleX() * event.getZoomFactor()); rect.setScaleY(rect.getScaleY() * event.getZoomFactor()); System.out.println("Rectangle: Zoom event" + ", inertia: " + event.isInertia() + ", direct: " + event.isDirect()); event.consume(); } }); rect.setOnZoomStarted(new EventHandler<ZoomEvent>() { @Override public void handle(ZoomEvent event) { System.out.println("Rectangle: Zoom event started"); event.consume(); } }); rect.setOnZoomFinished(new EventHandler<ZoomEvent>() { @Override public void handle(ZoomEvent event) { System.out.println("Rectangle: Zoom event finished"); event.consume(); } }); rect.setOnRotate(new EventHandler<RotateEvent>() { @Override public void handle(RotateEvent event) { rect.setRotate(rect.getRotate() + event.getAngle()); System.out.println("Rectangle: Rotate event" + ", inertia: " + event.isInertia() + ", direct: " + event.isDirect()); event.consume(); } }); rect.setOnRotationStarted(new EventHandler<RotateEvent>() { @Override public void handle(RotateEvent event) { System.out.println("Rectangle: Rotate event started"); event.consume(); } }); rect.setOnRotationFinished(new EventHandler<RotateEvent>() { @Override public void handle(RotateEvent event) { System.out.println("Rectangle: Rotate event finished"); event.consume(); } }); rect.setOnSwipeRight(new EventHandler<SwipeEvent>() { @Override public void handle(SwipeEvent event) { System.out.println("Rectangle: Swipe right event"); event.consume(); } }); rect.setOnSwipeLeft(new EventHandler<SwipeEvent>() { @Override public void handle(SwipeEvent event) { System.out.println("Rectangle: Swipe left event"); event.consume(); } }); rect.setOnTouchPressed(new EventHandler<TouchEvent>() { @Override public void handle(TouchEvent event) { System.out.println("Rectangle: Touch pressed event"); event.consume(); } }); rect.setOnTouchReleased(new EventHandler<TouchEvent>() { @Override public void handle(TouchEvent event) { System.out.println("Rectangle: Touch released event"); event.consume(); } }); rect.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.isSynthesized()) { System.out.println( "Ellipse: Mouse pressed event from touch" + ", synthesized: " + event.isSynthesized()); } event.consume(); } }); rect.setOnMouseReleased(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.isSynthesized()) { System.out.println( "Ellipse: Mouse released event from touch" + ", synthesized: " + event.isSynthesized()); } event.consume(); } }); primaryStage.setScene(scene); primaryStage.show(); }
From source file:deincraftlauncher.InstallController.java
@Override public void initialize(URL url, ResourceBundle rb) { instance = this; System.out.println("Starting Installer UI..."); int saveX = 393; int cancelY = 165; int saveY = 200; int sizeX = 481; Rectangle separator = new Rectangle(); separator.setWidth(sizeX);//from www. j ava2 s. co m separator.setHeight(separatorSizeY); separator.setLayoutY(separatorY); separator.setFill(blueColor); mainPanel.getChildren().add(separator); mainPanel.setBackground(Background.EMPTY); TextButton cancel = new TextButton(saveX, cancelY, "cancel", Color.RED, mainPanel); cancel.setOnClick((TextButton tile) -> { cancel(); }); save = new TextButton(saveX, saveY, "Weiter", Color.GRAY, mainPanel); save.setFocusable(false); save.setOnClick((TextButton tile) -> { Continue(); }); login = new TextButton(14, 151, "Login", Color.BLUE, mainPanel); login.setOnClick((TextButton tile) -> { doLogin(null); }); Label Title = new Label(); Title.setText("Installer"); Title.setPrefSize(sizeX, separatorY); Title.setTextFill(Color.WHITESMOKE); Title.setTextAlignment(TextAlignment.CENTER); Title.setFont(DesignHelpers.getFocusFont(42)); Title.setAlignment(Pos.CENTER); mainPanel.getChildren().add(Title); pathLabel.setBackground(new Background(new BackgroundFill(Color.rgb(170, 170, 170), radii, insets))); //ContinueButton.setBackground(new Background(new BackgroundFill(Color.rgb(100, 190, 100), radii, insets))); //Green Version setDefaultPath(); System.out.println("starting done"); }
From source file:Pages.LandingPage.java
public void profilePicture(String picture, Stage theStage) { // <editor-fold defaultstate="collapsed" desc="Circle Image"> profile_pic = (new ImageView(new Image(picture))); Rectangle square = new Rectangle(); square.setWidth(150);//from w w w .j av a 2s. c o m square.setHeight(150); profile_pic.setClip(square); Circle clip = new Circle(); clip.setCenterX(75); clip.setCenterY(75); clip.setRadius(75); profile_pic.fitWidthProperty().bind(square.widthProperty()); profile_pic.fitHeightProperty().bind(square.heightProperty()); profile_pic.setClip(clip); profile_pic.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent arg0) { createProfilePicture(theStage); } }); userbox.getChildren().add(profile_pic); // </editor-fold> }