summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing2702.java
blob: 5925695c51a324b76d02a4bd9065206ba2ff447c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Listing2702.java */

import java.awt.*;
import java.awt.event.*;

public class Listing2702
extends Window
{
  public static void main(String[] args)
  {
    final Listing2702 wnd = new Listing2702();
    wnd.setLocation(new Point(0,0));
    wnd.setSize(wnd.getToolkit().getScreenSize());
    wnd.setVisible(true);
    wnd.requestFocus();
    wnd.addKeyListener(
      new KeyAdapter() {
        public void keyPressed(KeyEvent event)
        {
          wnd.setVisible(false);
          wnd.dispose();
          System.exit(0);
        }
      }
    );
  }

  public Listing2702()
  {
    super(new Frame());
    setBackground(Color.black);
  }

  public void paint(Graphics g)
  {
    g.setColor(Color.red);
    g.drawString(
      "Bildschirmgr��e ist "+
      getSize().width+"*"+getSize().height,
      10,
      20
    );
    g.drawString("Bitte eine Taste dr�cken",10,40);
  }
}