0% found this document useful (0 votes)
5 views1 page

Splash Java

The document contains a Java class named 'Splash' that creates a splash screen for an electricity billing system application. It displays an image and gradually increases the window size before transitioning to a login frame after a 7-second delay. The class implements the Runnable interface to manage the splash screen's display timing using a separate thread.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Splash Java

The document contains a Java class named 'Splash' that creates a splash screen for an electricity billing system application. It displays an image and gradually increases the window size before transitioning to a login frame after a 7-second delay. The class implements the Runnable interface to manage the splash screen's display timing using a separate thread.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Electricity-Billing-System\src\electricity\billing\system\Splash.

java

1 package electricity.billing.system;
2
3 import javax.swing.*;
4 import java.awt.*;
5
6 public class Splash extends JFrame implements Runnable {
7 Thread t;
8 Splash() {
9
10 ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icon/elect.jpg"));
11 Image i2 = i1.getImage().getScaledInstance(730, 550, Image.SCALE_DEFAULT);
12 ImageIcon i3 = new ImageIcon(i2);
13 JLabel image = new JLabel(i3);
14 add(image);
15
16 setVisible(true);
17
18 int x = 1;
19 for (int i = 2; i < 600; i+=4, x+=1) {
20 setSize(i + x, i);
21 setLocation(700 - ((i + x)/2), 400 - (i/2));
22 try {
23 Thread.sleep(5);
24 } catch (Exception e) {
25 e.printStackTrace();
26 }
27 }
28
29 t = new Thread(this);
30 t.start();
31
32 setVisible(true);
33 }
34
35 public void run() {
36 try {
37 Thread.sleep(7000);
38 setVisible(false);
39
40 // login frame
41 new Login();
42 } catch (Exception e) {
43 e.printStackTrace();
44 }
45 }
46
47 public static void main(String[] args) {
48 new Splash();
49 }
50 }
51

You might also like