package fx.com;
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
// primaryStage.setOpacity(1); // 设置窗口的透明度
// primaryStage.setAlwaysOnTop(true); // 设置窗口置顶
// // 获取屏幕的宽度和高度
// Screen primary = Screen.getPrimary();
// Rectangle2D bounds = primary.getBounds();
//
// primaryStage.show();
// // 窗口居中显示
// primaryStage.setX((bounds.getWidth()-primaryStage.getWidth())/2);
// primaryStage.setY((bounds.getHeight()-primaryStage.getHeight())/2);
Stage s1 = new Stage();
//具有纯白色背景和平台装饰的舞台。
s1.initStyle(StageStyle.DECORATED);
s1.setTitle("s1");
s1.show();
Stage s2 = new Stage();
//一个纯白色背景且没有装饰的舞台。
s2.initStyle(StageStyle.UNDECORATED);
s2.setTitle("s2");
s2.show();
Stage s3 = new Stage();
//具有透明背景且没有装饰的舞台。
s3.initStyle(StageStyle.TRANSPARENT);
s3.setTitle("s3");
s3.show();
Stage s4 = new Stage();
//具有纯白色背景和最少平台装饰的舞台。
s4.initStyle(StageStyle.UTILITY);
// s4.initModality(Modality.APPLICATION_MODAL); //模态窗口
s4.initOwner(s1);
// 子窗口的模态对话框
s4.initModality(Modality.WINDOW_MODAL);
s4.setTitle("s4");
s4.show();
s4.centerOnScreen(); //设置居中
}
}