-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplash.java
57 lines (49 loc) · 1.46 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
/*
* © 26ANSH
* This Code Belongs To Ansh Vidyabhanu
*
* " Display the flash screen code "
* Included with three images = welcome.png, bye.png, intro.png
*
* Project details :
* " ~ Sandesha ~ " this is multiuser chat java GUI application
* the project uses concepts such as socket, java networking, JFrames, Java AWT, Java I/O and JDBC
* the project was made on December 1 2020 " the covid-19 year "
* Github account - 26ANSH
* Please use the code responsibly
* © 26ANSH
*/
package chat;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JWindow;
public class Splash extends JWindow
{
Image splashScreen;
ImageIcon imageIcon;
// Set Image properties
public Splash(String img)
{
splashScreen = Toolkit.getDefaultToolkit().getImage(img);
imageIcon = new ImageIcon(splashScreen);
setSize(imageIcon.getIconWidth(),imageIcon.getIconHeight());
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screenSize.width-getSize().width)/2;
int y = (screenSize.height-getSize().height)/2;
setLocation(x,y);
setVisible(true);
}
// Display image onto the Screen
public void paint(Graphics g)
{
super.paint(g);
g.drawImage(splashScreen, 0, 0, this);
}
public static void main(String[]args)
{
// called by other classes as and when required
}
}