/* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. */ package bugs; import javafx.application.Application; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.effect.PerspectiveTransform; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class PerspectiveEffectBug extends Application { Stage stage; Scene scene; @Override public void start(Stage stage) { stage.show(); scene = new Scene(new Group(), 400, 400); ObservableList content = ((Group)scene.getRoot()).getChildren(); /// Perspective content.add(perspective()); stage.setScene(scene); } static Node perspective() { Group g = new Group(); PerspectiveTransform pt = new PerspectiveTransform(); pt.setUlx(10.0f); pt.setUly(10.0f); pt.setUrx(310.0f); pt.setUry(40.0f); pt.setLrx(310.0f); pt.setLry(60.0f); pt.setLlx(10.0f); pt.setLly(90.0f); g.setEffect(pt); g.setCache(true); Rectangle r = new Rectangle(); r.setX(10.0f); r.setY(10.0f); r.setWidth(280.0f); r.setHeight(80.0f); r.setFill(Color.BLUE); Text t = new Text(); t.setX(20.0f); t.setY(65.0f); t.setText("Perspective"); t.setFill(Color.YELLOW); t.setFont(Font.font("null", FontWeight.BOLD, 36)); g.getChildren().add(r); g.getChildren().add(t); return g; } /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } }