-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimages.java
More file actions
62 lines (55 loc) · 1.44 KB
/
images.java
File metadata and controls
62 lines (55 loc) · 1.44 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package start;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
public class images extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
public static void main(String[]args) {
DisplayMode dm = new DisplayMode(800,600,16, DisplayMode.REFRESH_RATE_UNKNOWN);
images i = new images();
i.run(dm);
}
private screen s;
private Image bg;
private Image pic;
private boolean loaded;
//run method
public void run(DisplayMode dm) {
JFrame frame = new JFrame("TestFrame");
frame.getContentPane().setBackground(Color.BLUE);
setForeground(Color.WHITE);
setFont(new Font("Arial", Font.PLAIN, 24));
loaded = false;
s = new screen();
try {
s.setFullScreen(dm, this);
loadpics();
try {
Thread.sleep(5000);
}catch(Exception ex) {
}
}finally {
s.restoreScreen();
}
}
//loads pictures
public void loadpics() {
bg = new ImageIcon("C:\\laks.PNG").getImage();
pic = new ImageIcon("C:\\meme4.PNG").getImage();
loaded = true;
repaint();
}
public void paint(Graphics g) {
if(g instanceof Graphics2D) {
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}
if(loaded) {
g.drawImage(bg,170,180,null);
g.drawImage(pic, 170, 180, null);
}
}
}