如何在javaFX中翻译弹出窗口?

如何在javaFX中翻译弹出窗口?,java,javafx,javafx-2,javafx-8,scenebuilder,Java,Javafx,Javafx 2,Javafx 8,Scenebuilder,有没有办法在JavaFX中转换弹出窗口(不是节点)之类的东西? 例如,淡入淡出过渡、平移过渡或任何时间线过渡。 Thank的创建一个属性,并使用时间线来“动画化”该属性。使用属性注册侦听器,并在窗口值更改时更新窗口 例如: import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Applicatio

有没有办法在JavaFX中转换弹出窗口(不是节点)之类的东西? 例如,淡入淡出过渡、平移过渡或任何时间线过渡。
Thank的

创建一个属性,并使用时间线来“动画化”该属性。使用属性注册侦听器,并在窗口值更改时更新窗口

例如:

import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;

public class TranslateWindowExample extends Application {

    @Override
    public void start(Stage primaryStage) {
        Button moveButton = new Button("Move");

        moveButton.setOnAction(event -> {
            double currentX = primaryStage.getX() ;
            DoubleProperty x = new SimpleDoubleProperty(currentX);
            x.addListener((obs, oldX, newX) -> primaryStage.setX(newX.doubleValue()));
            KeyFrame keyFrame = new KeyFrame(Duration.seconds(1), new KeyValue(x, currentX + 100));
            Timeline animation = new Timeline(keyFrame);
            animation.play();
        });

        StackPane root = new StackPane(moveButton);
        Scene scene = new Scene(root, 250, 150);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

你能举一个什么叫弹出窗口的例子吗? 例如,您可以在主舞台的顶部创建一个新舞台。 您还可以使用一些工具提示类在窗口顶部添加一些文本。 如果你想要更经典的窗口,你应该看看Alert类

安东尼