1 ////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // @title FullScreenTest.java
4 //
5 // @discription 全屏幕显示
6 //
7 // @author hcm
8 //
9 // @date 2006-12
10 //
11 ////////////////////////////////////////////////////////////////////////////////////////////
12 import java.awt.*;
13 import java.awt.event.*;
14 import javax.swing.*;
15
16 public class FullScreenTest
17 {
18 public static void main (String[] args)
19 {
20
21 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
22 GraphicsDevice gd = ge.getDefaultScreenDevice ();
23 TestFullScreen myWindow = new TestFullScreen ();
24
25 if ( gd.isFullScreenSupported () )//如果支持全屏
26 gd.setFullScreenWindow (myWindow);
27 else
28 System.out.println ("Unsupported full screen.");
29
30 }
31 }
32
33 class TestFullScreen extends JWindow
34 {
35 public TestFullScreen ()
36 {
37 this.addMouseListener (new MouseAdapter ()
38 {
39 public void mousePressed (MouseEvent evt)
40 {
41 // TestFullScreen.this.setPreferredSize(new Dimension(200,300));
42 quit ();
43 //System.exit(0);
44 }
45 });
46 }
47
48 public void quit ()
49 {
50 this.dispose ();
51 }
52
53 public void paint (Graphics g)
54 {
55 g.setFont (new Font ("system",Font.BOLD,30));
56 g.setColor (Color.RED);
57 g.drawString ("这是全屏幕模式",100,100);
58
59 }
60
61 }
62
63
posted on 2007-02-06 17:02
-274°C 阅读(358)
评论(0) 编辑 收藏 所属分类:
JAVA