01: /*
02: *
03: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
04: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License version
08: * 2 only, as published by the Free Software Foundation.
09: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * General Public License version 2 for more details (a copy is
14: * included at /legal/license.txt).
15: *
16: * You should have received a copy of the GNU General Public License
17: * version 2 along with this work; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22: * Clara, CA 95054 or visit www.sun.com if you need additional
23: * information or have any questions.
24: */
25:
26: package tests.fullScreenMode;
27:
28: import java.awt.*;
29: import java.awt.event.*;
30:
31: public class TestFull extends Frame implements MouseListener {
32: boolean clicked = false;
33:
34: TestFull() {
35: addMouseListener(this );
36:
37: }
38:
39: public void startTest() {
40: GraphicsDevice gd = GraphicsEnvironment
41: .getLocalGraphicsEnvironment().getDefaultScreenDevice();
42: System.out.println("full screen support is "
43: + gd.isFullScreenSupported());
44: System.out.println("getFullScreenWindow returns "
45: + gd.getFullScreenWindow());
46:
47: System.out.println("Calling setFullScreen with frame");
48: gd.setFullScreenWindow(this );
49: while (!clicked) {
50: try {
51: wait(300);
52: } catch (Exception ex) {
53: }
54: }
55: System.out.println("Calling setFullScreen with null");
56: gd.setFullScreenWindow(null);
57: }
58:
59: public void paint(Graphics g) {
60: g.drawString("Click on the frame to leave full screen mode",
61: 20, 50);
62: }
63:
64: public void mouseClicked(MouseEvent e) {
65: clicked = true;
66: }
67:
68: public void mousePressed(MouseEvent e) {
69: }
70:
71: public void mouseReleased(MouseEvent e) {
72: }
73:
74: public void mouseEntered(MouseEvent e) {
75: }
76:
77: public void mouseExited(MouseEvent e) {
78: }
79:
80: public static void main(String args[]) {
81: TestFull tf = new TestFull();
82: //tf.setLocation(200, 200);
83:
84: tf.setVisible(true);
85: tf.setLocation(0, 0);
86: tf.setSize(200, 200);
87: tf.startTest();
88: }
89:
90: }
|