/* * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any */ package test.scenegraph.app; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.effect.Effect; import javafx.scene.effect.Reflection; import javafx.scene.effect.Glow; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; public class BugAppReflection extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 600, 450); stage.setScene(scene); stage.show(); final Canvas canvas1 = new Canvas(270, 270); VBox vb1 = new VBox(); vb1.setStyle("-fx-border-color: blue;"); vb1.getChildren().add(canvas1); GraphicsContext gc1 = canvas1.getGraphicsContext2D(); final Canvas canvas2 = new Canvas(270, 270); VBox vb2 = new VBox(); vb2.setStyle("-fx-border-color: blue;"); vb2.getChildren().add(canvas2); GraphicsContext gc2 = canvas2.getGraphicsContext2D(); // Effect eff = new Glow(){{ setLevel(1f); }}; Effect eff = new Reflection(); gc1.setEffect(eff); gc1.setFill(Color.RED); gc1.setFont(new Font(36)); gc1.fillText("TEXT!", 40, 80); // gc.setEffect(new Reflection()); gc2.setFill(Color.RED); gc2.setFont(new Font(36)); gc2.fillText("TEXT!", 40, 80); gc2.applyEffect(eff) ; HBox hb = new HBox(); hb.getChildren().addAll(vb1,vb2); root.getChildren().addAll(hb); } }