Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[RESOLU] [JAVA] Redimensionner à chaque changement de la fenêtre

Featured Replies

Posté(e)

Bonjour,

Voilà, j'ai créer des "JTextArea" et "JScrollPane" dans ma fenêtre d'application (eux même au coeur de JPanel pour gérer le Layout). Je leur deffinis une tail avec "setPreferredSize" en récupérant la tail de l'écran au lancement :

txt_message.setPreferredSize(new Dimension(310,500));

=>> txt_message = JTextArea

Zone_message.setPreferredSize(new Dimension((PageX/2)-50,PageY-200));

=>> Zone_message = JScrollPane

txt_analyse.setPreferredSize(new Dimension(310,500));

=>> txt_analyse = JTextArea

Zone_analyse.setPreferredSize(new Dimension((PageX/2)-50,PageY-200));

=>> Zone_analyse = JScrollPane

Plus loin à chaque changement que subit la fenêtre je cherche à moddifier leur tails :

   Toolkit kit = Toolkit.getDefaultToolkit();   Dimension tailleEcran = kit.getScreenSize();   int EcranX = tailleEcran.width;   int EcranY = tailleEcran.height;Dimension PageSize;   int FenX, FenY;/...   public void windowStateChanged(WindowEvent event) {PageSize = this.getSize();FenX = PageSize.width;FenY = PageSize.height;//System.out.println("Tail Fenêtre X : " + FenX + "; Tail Page : " +EcranX);if (FenX > EcranX-20) {	Zone_message.setPreferredSize(new Dimension((EcranX/2)-50,EcranY-200));	Zone_analyse.setPreferredSize(new Dimension((EcranX/2)-50,EcranY-200));			}if (FenX <= EcranX-20) {	Zone_message.setPreferredSize(new Dimension(335,335));	Zone_analyse.setPreferredSize(new Dimension(335,335));}setVisible(true);   }

"FenX" contenant la largeur de la fenêtre et "PageX" la largeur de l'écran je cherche à redimentioner mes objets JScrollPane à chaque changement de tail de ma fenêtre par raport à la tail total d'écran.

OR GROS PROBLEME > Cela marche de temps en temps mes pas à chaque fois !

Quand je lance l'application,et que cela fonctionne, alors cela continue à fonctionné jusqu'à ce que j'iconifie ma fenêtre, puis plus après !

Si cela ne marche pas au lancement rien ne changera ce fait plus tard !

Et cela marche par moment, puis plus un certain temps, pour recommencer à marcher une fois, puis plus...

ET CELA SANS RIEN CHANGER AU CODE LUI MEME !!!

J'ai crue à un problème de setVisible ou repaint, main cela n'à rien changer !

Est-ce que quelqu'un vois une solution à mon problème ?

Merci beaucoup d'avance !

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.