ImageView Reflection in Java Fx 2.0

This is the sample program for running image view in JavaFx2.0.Reflection effect has been applied to the image that have been loaded.We have load the image in to the Image view component of the JavaFx 2.0 and then we have load it in the scene that we have to display.
// Comment
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package ImageReflection;

import java.awt.Color;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.effect.Reflection;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

 * @author
public class ImageReflection extends Application {

     * @param args the command line arguments
    public static void main(String[] args) {
    public void start(Stage primaryStage) {
          primaryStage.setTitle("Hello World!");
          StackPane root = new StackPane();
          Image img = new Image(ImageReflection.class.getResource("image1.jpg").toString());
          ImageView sample = new ImageView(img);
          final Reflection reflection = new Reflection();
          primaryStage.setScene(new Scene(root,800, 600,javafx.scene.paint.Color.BLACK));

test Web Developer

No comments:

Post a comment

Related Posts Plugin for WordPress, Blogger...