-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdbJLabel.java
More file actions
37 lines (28 loc) · 779 Bytes
/
dbJLabel.java
File metadata and controls
37 lines (28 loc) · 779 Bytes
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
import java.net.*;
import javax.swing.*;
import java.awt.*;
public class dbJLabel extends JLabel
{
private Image dbImage;
private Graphics dbg;
dbJLabel( String text, int pos )
{
super( text, pos );
}
public void update(Graphics g)
{
// initialize buffer
if (dbImage == null)
{
dbImage = createImage (this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics ();
}
// clear screen in background
dbg.setColor (getBackground ());
dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
// draw elements in background
paint(dbg);
// draw image on the screen
g.drawImage (dbImage, 0, 0, this);
}
}