In this article we will learn, How to make Splash Screen in NetBeans. Guys, as you know splash screen make your application good looking.It is so simple and easy, if you know the complete procedure and just takes few minutes.
The meaning of splash screen is to respond the people during initializing the program and it contains program name and some additional information about software. It also makes software good look.
Demo:
Source Code Structure:
Here is the source code of Splash screen. But this the structure of Splash Screen source code:
package /*Insert package name here*/;
/**
*
* @author faizan
*/
public class /*Class name*/ {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
/*Insert here the class name of your jFrameForm*/ /*object reference*/ =new /*nsert here the class name of your jFrameForm*/();
/*object reference*/.setVisible(true);
try{
for(int p=0; p <=100;p++){
Thread.sleep(100);
/*object reference*/.jProgressBar1.setValue(p);
/*object reference*/.jLabel2.setText("Loading Please Wait..."+(Integer.toString(p))+"%");
if(p==100){
/*object reference*/.setVisible(false);
}
}
}catch (Exception e){
}
}
}
Project Source Code:
Here is the source code of Splash screen. This is the source code of my created project.
package splashscr;
public class SplashScr {
public static void main(String[] args) {
scr scr=new scr();
scr.setVisible(true);
try{
for(int p=0;p<=100;p++){
Thread.sleep(90);
scr.jProgressBar1.setValue(p);
scr.jLabel.setText("Loading Please wait..."+(Integer.toString(p)+"%"));
if(p==100){
scr.setVisible(false);
}
}
}catch(Exception e){
}
}
}
First of all open your favorite IDE for creating a Splash screen. In the given video I am going to use NetBeans. Now, create a new java project. Now, add a new java class in your Java project. Then insert the whole source code in your java class and customize it. To make customization easy I added comments in the code, read the code carefully and fill the comments. Now, you need to create a jFrameForm in your java project. In the JFrameForm you need to add Absolute layout on your JFrameForm. And add a label on it. Now add the image on your label and after adding the image add a progress bar here from the side bar swing controls. Now you need to add a label on the upside of your progress bar. And finally, now you can customize your splash screen according to your taste. But these were highlights, if you want to create you can see the given video.
0 comments: