/*
 * function : Realization of flash screen interface
 * 
 * */
package com.mhl.view;
import java.awt.*;
import javax.swing.*;
public class Index extends JWindow implements Runnable{
// Define components related to the progress bar
JProgressBar jpb;// Define progress bar
JLabel jl1;// Use to place a picture in the north of the form , South is the progress bar
int width,height;// Used to obtain the resolution size of the display screen
public static void main(String []args){
Index index=new Index();
// establish index thread
Thread t=new Thread(index);
// Start thread
t.start();
}
// Constructor
public Index()
{
// create label , And put a picture on the label
jl1=new JLabel(new ImageIcon("image/index/index.gif"));

// Create progress bar
jpb=new JProgressBar();
// Set progress bar properties
jpb.setStringPainted(true);// Display current progress value information
jpb.setIndeterminate(false);// Make sure that the progress bar does not scroll back and forth after execution
jpb.setBorderPainted(false);// Set progress bar border not to display
jpb.setBackground(Color.darkGray);// Set the background color of the progress bar

// add component
this.add(jl1,BorderLayout.NORTH);
this.add(jpb,BorderLayout.SOUTH);

// Set form properties
this.setSize(400,263);
// Set the position of the form display
width=Toolkit.getDefaultToolkit().getScreenSize().width;
height=Toolkit.getDefaultToolkit().getScreenSize().height;
this.setLocation(width/2-200,height/2-150);
// Set window display
this.setVisible(true);
}
// Progress bar thread's run method , Properties for setting threads
public void run() {

// Define an array , Store data needed for progress bar display
int
[]progressValue={0,1,5,8,14,17,26,35,38,43,49,56,65,71,75,78,86,94,98,99,100};
for(int i=0;i<progressValue.length;i++)
{
try {
// dormancy 1 second , Reexecution
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
jpb.setValue(progressValue[i]);// Get the progress value in the array
}
// When progress is complete , Perform the appropriate action , Such as switching to other windows , At the same time, close the progress bar window, etc
new Login();
// Close progress bar window
this.dispose();
}
}

Technology
©2019-2020 Toolsou All rights reserved,
Vue Development tips ( Essence 2020 year 6 month 3 Daily update ) TypeScript Detailed explanation of Chinese interface C Language confession practice small program ( Suitable for beginners )Python read Excel A column | Transfer deposit jsonGolang Array bisection , Array split , Array grouping Vue Transfer parameters and receiving of page Jump [RK3399][Android7.1] Learning notes DRM Driver development ( introduce ) Output string at specified position --PTA about Navicat for mysql Of 2003 error use PyMC3 Bayesian statistical analysis was performed ( code + example )