-
Notifications
You must be signed in to change notification settings - Fork 0
/
Splash.java
61 lines (46 loc) · 1.6 KB
/
Splash.java
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.API4CC;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingConstants;
import javafx.scene.image.Image;
/**
*
* @author Br
*/
public class Splash {
private final int LARGURA_IMG = 620;
private final int ALTURA_IMG = 460;
private final int TEMPO_DE_SPLASH = 6000;
private final String CAMINHO_GIF = "/inicio.jpg";
public void splash(){
JWindow janelaSplash = new JWindow();
janelaSplash.getContentPane().add(
new JLabel(
"As Aventuras de Darion",
new ImageIcon(getClass().getResource(CAMINHO_GIF)),
SwingConstants.CENTER
)
);
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension dimension = toolkit.getScreenSize();
janelaSplash.setBounds(
(dimension.width - LARGURA_IMG) / 2,
(dimension.height - ALTURA_IMG)/ 2,
LARGURA_IMG,
ALTURA_IMG
);
janelaSplash.setVisible(true);
try{
Thread.sleep(TEMPO_DE_SPLASH);
}catch(InterruptedException e){}
janelaSplash.dispose();
}
}