Bonjour a tous,
J'aimerai passer ma frame en plein écran, mais avec un bouton.
J'ai fait ce code:
et je change le boolean fullScreen avec:
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 if(fullScreen){ this.setUndecorated(true); GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); device.setFullScreenWindow(this); this.setVisible(false); this.setVisible(true); }else{ this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Fermer le programme this.setSize(getFrameWidth()/2, getFrameHeight()/2); //a mettre avent setLocationRelativeTo this.setLocationRelativeTo(null); //Centrer la fenetre this.setTitle("coucou"); this.setResizable(true);// redimentionnement }
sauf que c'est bien mais ca me rafraichi pas la fenêtre.
Code : Sélectionner tout - Visualiser dans une fenêtre à part public void setFullScreen(){ fullScreen = !fullScreen; }
Alors j'ai essayé frame.repaint() et frame = new Frame() mais là je sèche je sui a cour d'idées.
Merci de votre aide.
Partager