Java 类javafx.scene.effect.Reflection 实例源码

项目:marathonv5    文件:ReflectionSample.java   
public ReflectionSample() {
    super(100,200);
    ImageView sample = new ImageView(BOAT);
    sample.setPreserveRatio(true);
    sample.setFitHeight(100);
    final Reflection reflection = new Reflection();
    sample.setEffect(reflection);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:ReflectionSample.java   
public ReflectionSample() {
    super(100,200);
    ImageView sample = new ImageView(BOAT);
    sample.setPreserveRatio(true);
    sample.setFitHeight(100);
    final Reflection reflection = new Reflection();
    sample.setEffect(reflection);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d)
    );
    // END REMOVE ME
}
项目:CalendarFX    文件:HelloWeekDayHeaderView.java   
@Override
protected Node wrap(Node node) {
    HBox box = new HBox();
    box.setMaxWidth(Double.MAX_VALUE);
    box.setAlignment(Pos.CENTER);
    box.setFillHeight(false);

    StackPane stackPane = new StackPane();
    stackPane.setStyle("-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 20px;");
    box.getChildren().add(stackPane);

    stackPane.getChildren().add(node);
    stackPane.setEffect(new Reflection());

    return box;
}
项目:CalendarFX    文件:HelloTimeScaleView.java   
@Override
public Node wrap(Node node) {

    HBox box = new HBox();
    box.setStyle("-fx-padding: 100px;");
    box.setAlignment(Pos.CENTER);
    box.setFillHeight(false);

    StackPane stackPane = new StackPane();
    stackPane.setStyle(
            "-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 0 20 0 20;");
    box.getChildren().add(stackPane);

    stackPane.getChildren().add(node);
    stackPane.setEffect(new Reflection());

    return box;
}
项目:CalendarFX    文件:HelloWeekTimeScaleView.java   
@Override
protected Node wrap(Node node) {
    HBox box = new HBox();
    box.setStyle("-fx-padding: 100px;");
    box.setAlignment(Pos.CENTER);
    box.setFillHeight(false);

    StackPane stackPane = new StackPane();
    stackPane.setStyle(
            "-fx-background-color: white; -fx-border-color: gray; -fx-border-width: .25px; -fx-padding: 0 20 0 20;");
    box.getChildren().add(stackPane);

    stackPane.getChildren().add(node);
    stackPane.setEffect(new Reflection());

    return box;
}
项目:voogasalad-ltub    文件:PasswordManager.java   
private GridPane createGridPane(Label lblUserName, Label lblPassword, Label lblLanguage, Button btnLogin,
        Button btnReset, Button btnRegister) {
    GridPane gridPane = new GridPane();
    gridPane.setPadding(new Insets(20,20,20,20));
    gridPane.setHgap(5);
    gridPane.setVgap(5);   
    gridPane.add(lblUserName, 0, 0);
    gridPane.add(txtUserName, 1, 0);
    gridPane.add(lblPassword, 0, 1);
    gridPane.add(pf, 1, 1);
    gridPane.add(btnLogin, 2, 0);
    gridPane.add(btnReset, 2, 1);
    gridPane.add(lblMessage, 1, 2);
    gridPane.add(btnRegister, 2, 2);
    gridPane.add(lblLanguage, 0, 3);
    gridPane.add(createComboBox(), 1 , 3);
    //Reflection for gridPane
    Reflection r = new Reflection();
    r.setFraction(0.7f);
    gridPane.setEffect(r);
    return gridPane;
}
项目:livro-javafx-pratico    文件:DigaOlaComJavaFX.java   
@Override
public void start(Stage palco) throws Exception {
    final Effect r = new Reflection();
    final VBox raiz = new VBox(30);
    final HBox hbTopo = new HBox(5);
    final TextField txtNome = new TextField();
    final Button btnAcao = new Button("Enviar");
    final Label lblMensagem = new Label();
    raiz.setTranslateX(10);
    raiz.setTranslateY(10);
    lblMensagem.setText("Digite seu nome e clique no botão");
    hbTopo.getChildren().addAll(txtNome, btnAcao);
    raiz.getChildren().addAll(hbTopo, lblMensagem);
    lblMensagem.setEffect(r);
    Scene cena = new Scene(raiz, 250, 100);
    palco.setTitle("Aplicação usando código Java");
    palco.setScene(cena);
    palco.show();

    btnAcao.setOnAction(e -> lblMensagem.setText("Olá, " + txtNome.getText() + ", bem vindo!"));
}
项目:mars-sim    文件:FXInSwing.java   
public FXInSwing(){
    panel = new JFXPanel();
    Platform.runLater(new Runnable(){
        @Override
        public void run() {
            stack = new StackPane();
            scene = new Scene(stack,300,300);
            hello = new Text("Hello");

            scene.setFill(Color.BLACK);
            hello.setFill(Color.WHEAT);
            hello.setEffect(new Reflection());

            panel.setScene(scene);
            stack.getChildren().add(hello);

            wait = false;
        }
    });
    this.getContentPane().add(panel);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setSize(300, 300);
    this.setVisible(true);
}
项目:javafx-demos    文件:BlurEffectDemo.java   
private Node gaussianBlur() {
    Text t2 = new Text();
    t2.setX(10.0f);
    t2.setY(250.0f);
    t2.setCache(true);
    t2.setText("Gaussian Blur");
    t2.setFill(Color.RED);
    t2.setFont(Font.font("null", FontWeight.BOLD, 36));

    DropShadow shadow = new DropShadow();
    shadow.setOffsetY(3.0);
    shadow.setOffsetX(3.0);
    shadow.setColor(Color.GRAY);
    shadow.setInput(new GaussianBlur());

    Reflection rf = new Reflection();
    rf.setFraction(1.5);
    rf.setInput(shadow);

    t2.setEffect(rf);
    return t2;
}
项目:kotlinfx-ensemble    文件:ReflectionSample.java   
public ReflectionSample() {
    super(100,200);
    ImageView sample = new ImageView(BOAT);
    sample.setPreserveRatio(true);
    sample.setFitHeight(100);
    final Reflection reflection = new Reflection();
    sample.setEffect(reflection);
    getChildren().add(sample);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d)
    );
    // END REMOVE ME
}
项目:jmusic    文件:GetArtist.java   
private void createControls() {
    artist = new Label();
    artist.setId("artist");
    album = new Label();
    album.setId("album");
    title = new Label();
    title.setId("title");
    year = new Label();
    year.setId("year");
    albumCover=new ImageView();
    final Reflection reflection = new Reflection();
    reflection.setFraction(0.2);

//    final URL url = getClass().getResource("resources/defaultAlbum.png");
 //   final Image image = new Image(url.toString());

//    albumCover = new ImageView(image);
 //   albumCover.setFitWidth(240);
  //  albumCover.setPreserveRatio(true);
   // albumCover.setSmooth(true);
   // albumCover.setEffect(reflection);
  }
项目:marathonv5    文件:ReflectionSample.java   
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final Reflection reflection = new Reflection();
    reflection.setTopOffset(-28d);
    reflection.setFraction(0.5);
    sample.setEffect(reflection);
    return sample;
}
项目:marathonv5    文件:ReflectionSample.java   
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final Reflection reflection = new Reflection();
    reflection.setTopOffset(-28d);
    reflection.setFraction(0.5);
    sample.setEffect(reflection);
    return sample;
}
项目:GazePlay    文件:Clavier.java   
public Clavier(Instru instru) {

        this.instru = instru;// l'objet de type Instru prend la valeur de l'objet passé en paramètre

        Rectangle fond_clavier = new Rectangle();
        fond_clavier.setWidth(400);
        fond_clavier.setHeight(200);
        fond_clavier.setArcWidth(30);
        fond_clavier.setArcHeight(30);
        fond_clavier.setFill( // on remplie notre rectangle avec un dégradé
                new LinearGradient(0f, 0f, 0f, 1f, true, CycleMethod.NO_CYCLE,
                        new Stop[] { new Stop(0, Color.web("#333333")), new Stop(1, Color.web("#000000")) }));
        Reflection r = new Reflection();// on applique un effet de réflection
        r.setFraction(0.25);
        r.setBottomOpacity(0);
        r.setTopOpacity(0.5);
        fond_clavier.setEffect(r);

        touches = new Touche[] { new Touche("U", 50, 20, 60, instru), new Touche("I", 128, 20, 62, instru),
                new Touche("O", 206, 20, 64, instru), new Touche("P", 284, 20, 65, instru),
                new Touche("J", 75, 98, 67, instru), new Touche("K", 153, 98, 69, instru),
                new Touche("L", 231, 98, 71, instru), new Touche("M", 309, 98, 72, instru) };

        this.setTranslateX(50);
        this.setTranslateY(250);
        this.getChildren().add(fond_clavier);

        for (Touche touche : touches) { // on insère chaque touche une par une.
            this.getChildren().add(touche);
        }

    }
项目:openjfx-8u-dev-tests    文件:CanvasEffects2App.java   
List<NamedEffect> getNamedEffectList() {
    List<NamedEffect> nes = new ArrayList<NamedEffect>();
    nes.add(new NamedEffect("default", new Reflection() ));
    nes.add(new NamedEffect("bottom opacity 0.7", new Reflection() {{setBottomOpacity(.7f);}}));
    nes.add(new NamedEffect("fraction: 0.5", new Reflection() {{setFraction(0.5f);}}));
    nes.add(new NamedEffect("top offset: 15", new Reflection() {{setTopOffset(15);}}));
    nes.add(new NamedEffect("top opacity: 0.9", new Reflection() {{setTopOpacity(.9f);}}));

    return nes;
}
项目:livro-javafx-pratico    文件:AprendendoTransicoes.java   
private void criaNoAlvo() {
    // configurar coisas do texto alvo...
    alvo = new Text("** Transições **");
    alvo.setFont(new Font(60));
    // efeitinsss
    Reflection efeito = new Reflection();
    efeito.setFraction(0.7);
    alvo.setEffect(efeito);
    alvo.setFill(Color.RED);
    raiz.setCenter(alvo);

}
项目:mars-sim    文件:SlideDemo.java   
/**
 * Location String with specified effect, font, and position.
 * 
 * @return Location String with specified effect, font, and position.
 */
private Text generateLocationText()
{
   final Reflection reflection = new Reflection();
   reflection.setFraction(1.0);
   return TextBuilder.create()
                     .text("Schiaparelli Point, Mars").x(20).y(20)
                     .font(Font.font(java.awt.Font.SANS_SERIF, 25))
                     .effect(reflection)
                     .build();
}
项目:javafx-demos    文件:CursorsDemo.java   
public MyButton(String text, Cursor cursor){
    setText(text);
    setFont(new Font("Tahoma", 18));
    setEffect(new Reflection());
    setCursor(cursor);
    setPrefWidth(150);
}
项目:javafx-demos    文件:DominoSkin.java   
public DominoSkin(final Domino CONTROL) {
    super(CONTROL, new DominoBehavior(CONTROL));
    control     = CONTROL;
    domino      = new Group();
    dots        = new Group();
    dotMap      = new HashMap<Domino.Dot, Shape>(12);
    reflection  = new Reflection();
    initialized = false;
    isDirty     = false;
    init();
}
项目:kotlinfx-ensemble    文件:ReflectionSample.java   
public static Node createIconContent() {
    Text sample = new Text("FX");
    sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
    sample.setStyle("-fx-font-size: 80px;");
    sample.setFill(Color.web("#333333"));
    final Reflection reflection = new Reflection();
    reflection.setTopOffset(-28d);
    reflection.setFraction(0.5);
    sample.setEffect(reflection);
    return sample;
}
项目:sevenwonders    文件:Wonders.java   
Wonders(Image image, double screenX2, double screenY2, boolean abled, int Num, TPABoard t, Group r) {
    tpa = t;
    root = r;
    for (int i = 0; i < 15; i++) {
        hasRes[i] = 0;
    }
    pic = image;
    NUM = Num;
    screenX = screenX2;
    screenY = screenY2;
    numOfLeftBattle = 0;
    numOfRightBattle = 0;
    hasbuild = 0;
    gold = 0;
    army = 0;
    bigX = image.getWidth();
    bigY = image.getHeight();
    imageView = new ImageView();
    imageView.setImage(image);
    getChildren().add(imageView);
    setCache(true);
    coinView = new Group();
    getChildren().add(coinView);
    if (abled)
        imageView.setEffect(new Reflection());
    resSign = new Group();
    resSign.setLayoutY(60);
    resSign.setLayoutX(-9);
    getChildren().add(resSign);
}
项目:ewidgetfx    文件:ConferenceTour.java   
private WebView createWebView() {
    WebView webView = new WebView();
    engine = webView.getEngine();
    webView.getEngine().load(getClass().getResource("content.html").toString());
    webView.setEffect(new Reflection(10, .5, .75, 0));
    return webView;
}
项目:incubator-netbeans    文件:Fireworks.java   
public SanFranciscoFireworks() {
    // create a color palette of 180 colors
    colors = new Paint[181];
    colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(59, 0.38, 1)),
                new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)),
                new Stop(1, Color.hsb(59, 0.38, 1,0))
                );
    for (int h=0;h<360;h+=2) {
        colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(h, 1, 1)),
                new Stop(0.6, Color.hsb(h, 1, 1,0.1)),
                new Stop(1, Color.hsb(h, 1, 1,0))
                );
    }
    // create canvas
    canvas = new Canvas(1024, 500);

    canvas.setBlendMode(BlendMode.ADD);
    canvas.setEffect(new Reflection(0,0.4,0.15,0));
    background = new ImageView(getClass().getResource("sf.jpg").toExternalForm());
    getChildren().addAll(background,canvas);
    // create animation timer that will be called every frame
    // final AnimationTimer timer = new AnimationTimer() {
    timer = new AnimationTimer() {

        @Override public void handle(long now) {
            GraphicsContext gc = canvas.getGraphicsContext2D();
            // clear area with transparent black
            gc.setFill(Color.rgb(0, 0, 0, 0.2));
            gc.fillRect(0, 0, 1024, 708);
            // draw fireworks
            drawFireworks(gc);
            // countdown to launching the next firework
            if (countDownTillNextFirework == 0) {
                countDownTillNextFirework = 10 + (int)(Math.random()*30);
                fireParticle();
            }
            countDownTillNextFirework --;
        }
    };
}
项目:marathonv5    文件:FireworksSample.java   
public SanFranciscoFireworks() {
    // create a color palette of 180 colors
    colors = new Paint[181];
    colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(59, 0.38, 1)),
                new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)),
                new Stop(1, Color.hsb(59, 0.38, 1,0))
                );
    for (int h=0;h<360;h+=2) {
        colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(h, 1, 1)),
                new Stop(0.6, Color.hsb(h, 1, 1,0.1)),
                new Stop(1, Color.hsb(h, 1, 1,0))
                );
    }
    // create canvas
    canvas = new Canvas(1024, 500);

    canvas.setBlendMode(BlendMode.ADD);
    canvas.setEffect(new Reflection(0,0.4,0.15,0));
    background = new ImageView(getClass().getResource("sf.jpg").toExternalForm());
    getChildren().addAll(background,canvas);
    // create animation timer that will be called every frame
    // final AnimationTimer timer = new AnimationTimer() {
    timer = new AnimationTimer() {

        @Override public void handle(long now) {
            GraphicsContext gc = canvas.getGraphicsContext2D();
            // clear area with transparent black
            gc.setFill(Color.rgb(0, 0, 0, 0.2));
            gc.fillRect(0, 0, 1024, 708);
            // draw fireworks
            drawFireworks(gc);
            // countdown to launching the next firework
            if (countDownTillNextFirework == 0) {
                countDownTillNextFirework = 10 + (int)(Math.random()*30);
                fireParticle();
            }
            countDownTillNextFirework --;
        }
    };
}
项目:marathonv5    文件:FireworksSample.java   
public SanFranciscoFireworks() {
    // create a color palette of 180 colors
    colors = new Paint[181];
    colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(59, 0.38, 1)),
                new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)),
                new Stop(1, Color.hsb(59, 0.38, 1,0))
                );
    for (int h=0;h<360;h+=2) {
        colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(h, 1, 1)),
                new Stop(0.6, Color.hsb(h, 1, 1,0.1)),
                new Stop(1, Color.hsb(h, 1, 1,0))
                );
    }
    // create canvas
    canvas = new Canvas(1024, 500);

    canvas.setBlendMode(BlendMode.ADD);
    canvas.setEffect(new Reflection(0,0.4,0.15,0));
    background = new ImageView(getClass().getResource("sf.jpg").toExternalForm());
    getChildren().addAll(background,canvas);
    // create animation timer that will be called every frame
    // final AnimationTimer timer = new AnimationTimer() {
    timer = new AnimationTimer() {

        @Override public void handle(long now) {
            GraphicsContext gc = canvas.getGraphicsContext2D();
            // clear area with transparent black
            gc.setFill(Color.rgb(0, 0, 0, 0.2));
            gc.fillRect(0, 0, 1024, 708);
            // draw fireworks
            drawFireworks(gc);
            // countdown to launching the next firework
            if (countDownTillNextFirework == 0) {
                countDownTillNextFirework = 10 + (int)(Math.random()*30);
                fireParticle();
            }
            countDownTillNextFirework --;
        }
    };
}
项目:livro-javafx-pratico    文件:DesenhandoComCanvas.java   
@Override
public void start(Stage palco) throws Exception {
    // O construtor do Canvas recebe a largura e a altura
    Canvas canvas = new Canvas(300, 300);
    // O objeto principal do Canvas é o GraphicsContext, que usamos para desenhar
    GraphicsContext ctx = canvas.getGraphicsContext2D();
    // estamos prontos para desenhar coisas! Vamos começar mudando a cor
    ctx.setFill(Color.RED);
    // podemos configurar uma fonte para os textos
    ctx.setFont(Font.font("Serif", FontWeight.BOLD, 25));
    // desenhando um texto, o primeiro param é o texto, os seguintes são a pos X e Y
    ctx.fillText("Olá Mundo Canvas", 15, 30);
    // podemos configurar efeitos e novamente trocar a cor
    ctx.setFill(Color.BLUE);
    ctx.setEffect(new BoxBlur());
    ctx.fillText("Olá Mundo Canvas", 15, 60);
    // agora vamos trocar o efeito, cor e desenhar um retângulo(x,y, largura, altura)
    ctx.setEffect(new Reflection());
    ctx.setFill(Color.AQUA);
    ctx.fillRect(15, 90, 240, 20);
    // ou um retângulo sem preenchimento
    ctx.setStroke(Color.GREEN);
    ctx.strokeRect(15, 135, 240, 30);
    // ou circulos (forma oval)
    ctx.setEffect(null);
    ctx.setFill(Color.BROWN);
    ctx.fillOval(15, 175, 90, 25);
    ctx.setStroke(Color.YELLOWGREEN);
    // ou formas ovais sem preenchimento
    ctx.strokeOval(160, 175, 90, 25);
    // ou até desenhar uns poligonos locos, usando diversos pontos X e Y
    double xs[] = {15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270};
    double ys[] = {205, 235, 250, 265, 205, 235, 205, 205, 235, 250, 265, 205, 235, 205, 205, 235, 250, 205};
    ctx.setFill(Color.MAGENTA);
    ctx.setEffect(new Reflection());
    ctx.fillPolygon(xs, ys, 18);
    Scene cena = new Scene(new StackPane(canvas), 800, 600);
    palco.setTitle("Canvas");
    palco.setScene(cena);
    palco.show();
}
项目:mars-sim    文件:TabPanelDashboard.java   
/**
 * Constructor.
 *
 * @param settlement
 *            {@link Settlement} the settlement this tab panel is for.
 * @param desktop
 *            {@link MainDesktopPane} the main desktop panel.
 */
@SuppressWarnings("restriction")
public TabPanelDashboard(Settlement settlement, MainDesktopPane desktop) {
    // Use the TabPanel constructor
    super(Msg.getString("TabPanelDashboard.title"), //$NON-NLS-1$
            null, Msg.getString("TabPanelDashboard.title.tooltip"), //$NON-NLS-1$
            settlement, desktop);

    this.settlement = settlement;
    objectives = settlement.getObjectives();
    createButtonPane();

    jfxpanel = new JFXPanel();

    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            stack = new StackPane();
            scene = new Scene(stack, width, height);
            scene.setFill(Color.TRANSPARENT);// .BLACK);
            jfxpanel.setScene(scene);

            Label title = new Label(Msg.getString("TabPanelDashboard.title"));
            Reflection reflection = new Reflection();
            title.setEffect(reflection);
            reflection.setTopOffset(0.0);
            title.setPadding(new Insets(5, 5, 0, 5));
            // title.setFont(new Font("Arial", 20));
            title.setFont(Font.font("Cambria", FontWeight.BOLD, 16));

            VBox toggleVBox = new VBox();
            //toggleVBox.setStyle("-fx-border-style: 2px; " + "-fx-background-color: #c1bf9d;"
            //      + "-fx-border-color: #c1bf9d;" + "-fx-background-radius: 2px;");
            toggleVBox.getChildren().addAll(mainBox);
            toggleVBox.setAlignment(Pos.TOP_CENTER);
            toggleVBox.setPadding(new Insets(5, 5, 5, 5));

            VBox topVBox = new VBox();
            //topVBox.setStyle("-fx-border-style: 2px; " + "-fx-background-color: #c1bf9d;"
            //      + "-fx-border-color: #c1bf9d;" + "-fx-background-radius: 2px;");
            topVBox.setAlignment(Pos.TOP_CENTER);
            topVBox.getChildren().addAll(title, new Label(), toggleVBox);

            stack.getChildren().add(topVBox);
        }
    });

    centerContentPanel.add(jfxpanel);
    this.setSize(new Dimension(width, height));
    this.setVisible(true);

    update();
}
项目:ShopCarFX-2.0    文件:BoasVindasNode.java   
@Override
public void initComponents()
{
    title = new Label(TITLE);
    title.setId("title_3");   
    msg = new Label(MSG);
    msg.setId("msg-inicial");
    go = new Button("Go!");
    go.setId("dark-blue");
    vBox = new VBox();
    vBox.setAlignment(Pos.CENTER);
    vBox.setSpacing(40);

    rightPane = new BorderPane();
    rightPane.setPrefSize(PrimaryStage.WIDTH, PrimaryStage.HEIGHT);
    rightPane.setMinSize(0, 0);
    rightPane.setScaleX(1);
    rightPane.setId("fundo-padrao");
    leftPane = new BorderPane();
    leftPane.setPrefSize(PrimaryStage.WIDTH, PrimaryStage.HEIGHT);
    leftPane.setMinSize(0, 0);
    leftPane.setScaleX(1);
    leftPane.setId("fundo-padrao");
    topPane = new BorderPane();
    topPane.setPrefSize(PrimaryStage.WIDTH, PrimaryStage.HEIGHT);
    topPane.setMinSize(0, 0);
    topPane.setScaleX(1);
    topPane.setId("fundo-padrao");
    downPane = new BorderPane();
    downPane.setPrefSize(PrimaryStage.WIDTH, PrimaryStage.HEIGHT);
    downPane.setMinSize(0, 0);
    downPane.setScaleX(1);
    downPane.setId("fundo-padrao");
    centerPane = new BorderPane();
    centerPane.setPrefSize(PrimaryStage.WIDTH, PrimaryStage.HEIGHT);
    centerPane.setMinSize(0, 0);
    centerPane.setScaleX(1);
    centerPane.setId("fundo-padrao");
    centerPane.setCenter(vBox);


    final DropShadow drop = new DropShadow
    (BlurType.GAUSSIAN, Color.WHITE, 5, 1 , 1, 1);
    final Reflection r = new Reflection();
    r.setFraction(0.5f);
    r.setBottomOpacity(0.5);
    drop.setInput(r);
    title.setEffect(drop);



    vBox.getChildren().addAll(title, msg, go);

    getChildren().addAll(downPane, leftPane, topPane, rightPane, centerPane);


}
项目:javafx-demos    文件:FireworksSample.java   
public SanFranciscoFireworks() {
    // create a color palette of 180 colors
    colors = new Paint[181];
    colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(59, 0.38, 1)),
                new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)),
                new Stop(1, Color.hsb(59, 0.38, 1,0))
                );
    for (int h=0;h<360;h+=2) {
        colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(h, 1, 1)),
                new Stop(0.6, Color.hsb(h, 1, 1,0.1)),
                new Stop(1, Color.hsb(h, 1, 1,0))
                );
    }
    // create canvas
    canvas = new Canvas(1024, 500);

    canvas.setBlendMode(BlendMode.ADD);
    canvas.setEffect(new Reflection(0,0.4,0.15,0));
    background = new ImageView(getClass().getResource("/images/sf.jpg").toExternalForm());
    getChildren().addAll(background,canvas);
    // create animation timer that will be called every frame
    // final AnimationTimer timer = new AnimationTimer() {
    timer = new AnimationTimer() {

        @Override public void handle(long now) {
            GraphicsContext gc = canvas.getGraphicsContext2D();
            // clear area with transparent black
            gc.setFill(Color.rgb(0, 0, 0, 0.2));
            gc.fillRect(0, 0, 1024, 708);
            // draw fireworks
            drawFireworks(gc);
            // countdown to launching the next firework
            if (countDownTillNextFirework == 0) {
                countDownTillNextFirework = 10 + (int)(Math.random()*30);
                fireParticle();
            }
            countDownTillNextFirework --;
        }
    };
}
项目:kotlinfx-ensemble    文件:FireworksSample.java   
public SanFranciscoFireworks() {
    // create a color palette of 180 colors
    colors = new Paint[181];
    colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(59, 0.38, 1)),
                new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)),
                new Stop(1, Color.hsb(59, 0.38, 1,0))
                );
    for (int h=0;h<360;h+=2) {
        colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, 
                new Stop(0, Color.WHITE),
                new Stop(0.2, Color.hsb(h, 1, 1)),
                new Stop(0.6, Color.hsb(h, 1, 1,0.1)),
                new Stop(1, Color.hsb(h, 1, 1,0))
                );
    }
    // create canvas
    canvas = new Canvas(1024, 500);

    canvas.setBlendMode(BlendMode.ADD);
    canvas.setEffect(new Reflection(0,0.4,0.15,0));
    background = new ImageView(getClass().getResource("sf.jpg").toExternalForm());
    getChildren().addAll(background,canvas);
    // create animation timer that will be called every frame
    // final AnimationTimer timer = new AnimationTimer() {
    timer = new AnimationTimer() {

        @Override public void handle(long now) {
            GraphicsContext gc = canvas.getGraphicsContext2D();
            // clear area with transparent black
            gc.setFill(Color.rgb(0, 0, 0, 0.2));
            gc.fillRect(0, 0, 1024, 708);
            // draw fireworks
            drawFireworks(gc);
            // countdown to launching the next firework
            if (countDownTillNextFirework == 0) {
                countDownTillNextFirework = 10 + (int)(Math.random()*30);
                fireParticle();
            }
            countDownTillNextFirework --;
        }
    };
}
项目:JacpFX-misc    文件:Demo1Component.java   
@PostConstruct
/**
 * The @PostConstruct annotation labels methods executed when the component switch from inactive to active state
 * @param arg0
 * @param resourceBundle
 */
public void onPostConstructComponent(final FXComponentLayout arg0,
                                     final ResourceBundle resourceBundle) {
    String family = "Helvetica";

    TextFlow textFlow = new TextFlow();
    textFlow.setLayoutX(40);
    textFlow.setLayoutY(40);

    DropShadow ds = new DropShadow();
    ds.setOffsetY(6.0f);
    ds.setColor(Color.color(0.4f, 0.4f, 0.4f));

    Text text1 = new Text();
    text1.setX(5.0f);
    text1.setY(140.0f);
    text1.setCache(true);
    text1.setText("Welcome ");
    text1.setFill(Color.GREEN);
    text1.setFont(Font.font(null, FontWeight.BOLD, 36));
    text1.setEffect(ds);
    text1.setTranslateY(10);

    Text text2 = new Text();
    text2.setEffect(new GaussianBlur());
    text2.setCache(true);
    text2.setX(10.0f);
    text2.setY(270.0f);
    text2.setFill(Color.GREEN);
    text2.setText("to the ");
    text2.setFont(Font.font(null, FontWeight.BOLD, 22));
    text2.setTranslateY(50);

    Text text3 = new Text();
    text3.setX(10.0f);
    text3.setY(50.0f);
    text3.setCache(true);
    text3.setText("Trivadis");
    text3.setFill(Color.RED);
    text3.setFont(Font.font(null, FontWeight.BOLD, 50));
    Reflection r = new Reflection();
    r.setFraction(0.7f);
    text3.setEffect(r);
    text3.setTranslateY(80);

    Text text4 = new Text(" TechEvent!");
    text4.setFill(Color.RED);
    text4.setCache(true);
    text4.setFont(Font.font(family, FontWeight.BOLD, 60));
    text4.setEffect(new Glow());
    text4.setTranslateY(120);
    textFlow.getChildren().addAll(text1, text2, text3, text4);


    Group group = new Group(textFlow);
    tab.getChildren().add(group);
    this.log.info("run on start of Demo1Component ");

}