summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/update2.inc
blob: e0a93791a9d83683262ec6376a7bf9b834de9a77 (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
/* update2.inc */

public void update(Graphics g)
{
  //Double-Buffer initialisieren
  if (dbImage == null) {
    dbImage = createImage(
     this.getSize().width,
     this.getSize().height
    );
    dbGraphics = dbImage.getGraphics();
  }
  //Hintergrund l�schen
  dbGraphics.setColor(getBackground());
  dbGraphics.fillRect(
    0,
    0,
    this.getSize().width,
    this.getSize().height
  );
  //Vordergrund zeichnen
  dbGraphics.setColor(getForeground());
  paint(dbGraphics);
  //Offscreen anzeigen
  g.drawImage(dbImage,0,0,this);
}