bonjour a tous
je souhaiterez savoir si il est possible avec javafx de faire une application en mode plein écran qui sois bloquée en plein écran
de faire un code dans les touche tabulation ou alt + f4 ne puisse pas être utiliser pour quitter le mode plein écran
de tous bloquée et de n’autoriser qu'un bouton pour quitter ce mode plein écran.
j'ai longuement chercher mes j'ai rien trouver
Comment faire ?
voici mon code :
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 package testjframe; import java.awt.event.WindowEvent; import javafx.application.Application; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.event.EventType; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ToolBar; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.stage.StageStyle; public class JavaDemo extends Application { public static void main(String[] args) { launch(args); } class WindowButtons extends HBox { public WindowButtons() { Button closeBtn = new Button("X"); closeBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { //Platform.exit(); } }); this.setEventDispatcher(null); this.getChildren().add(closeBtn); } } @Override public void start(Stage primaryStage) { //remove window decoration primaryStage.initStyle(StageStyle.UNDECORATED); BorderPane borderPane = new BorderPane(); borderPane.setStyle("-fx-background-color: green;"); ToolBar toolBar = new ToolBar(); int height = 25; toolBar.setPrefHeight(height); toolBar.setMinHeight(height); toolBar.setMaxHeight(height); toolBar.getItems().add(new WindowButtons()); borderPane.setTop(toolBar); primaryStage.setScene(new Scene(borderPane, 3000, 2500)); primaryStage.show(); } }
Partager