1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package com.drazzib.netpisteur.util;
22
23 import java.awt.Frame;
24 import java.awt.GraphicsConfiguration;
25 import java.awt.GraphicsEnvironment;
26 import java.awt.Rectangle;
27
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30
31 public class SwingUtils {
32
33 private static Log log = LogFactory.getLog(SwingUtils.class);
34
35 /**
36 * Permet de maximiser la fenetre auto et d'tre sr qu'elle ne dpasse pas
37 * les capacits d'affichage de l'cran (rsolution) Maximise
38 *
39 * @param frame
40 * Frame
41 */
42 public static void maxFrame(Frame frame) {
43 GraphicsConfiguration gc = GraphicsEnvironment
44 .getLocalGraphicsEnvironment().getDefaultScreenDevice()
45 .getDefaultConfiguration();
46 Rectangle ct;
47
48 try {
49 ct = gc.getBounds();
50 frame.setSize(ct.width - 75, ct.height - 75);
51 } catch (NoSuchMethodError e) {
52
53 log.warn("Erreur de maximisation fenetre");
54 frame.setSize(800, 600);
55 }
56 }
57
58 }