只需要弹出窗口,然后全屏显示,并不需要上面提示的按ESC退出全屏模式的提示,可以在下面代码中加上就可以了:primaryStage.setFullScreenExitHint(“”);
package sample.main.alertt;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import java.io.IOException;
import java.lang.management.ManagementFactory;
public class alertt extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = null;
FXMLLoader loader = new FXMLLoader();
try {
loader.setLocation(getClass().getResource("/dialog.fxml"));
root = loader.load();
Label cc= (Label) root.lookup("#mes");
cc.setText("333");
System.out.println(root.lookup("#mes"));
Scene scene = null;
scene = new Scene(root, 1818, 810);
primaryStage.setScene(scene);
primaryStage.setFullScreen(true);
primaryStage.setFullScreenExitHint("");
primaryStage.setAlwaysOnTop(true);
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setResizable(false);
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
}