🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ package cy.view; import java.awt.*; import javax.swing.*; public class Index extends JWindow implements Runnable { JProgressBar jpb;//绘制进度条 JLabel jl1; int width,height; public static void main(String[] args) { Index index=new Index(); Thread t=new Thread(index);//启动线程-进度条 t.start(); } public Index() { jl1=new JLabel(new ImageIcon("image/index.gif")); jpb=new JProgressBar(); jpb.setStringPainted(true); jpb.setIndeterminate(false); jpb.setBorderPainted(false); jpb.setBackground(Color.darkGray); this.add(jl1,BorderLayout.NORTH); this.add(jpb,BorderLayout.SOUTH); this.setSize(400,263); width=Toolkit.getDefaultToolkit().getScreenSize().width; height=Toolkit.getDefaultToolkit().getScreenSize().height; this.setLocation(width/2-200,height/2-150); this.setVisible(true); } @Override public void run() { 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 { Thread.sleep(1000); } catch (Exception e) {} jpb.setValue(progressValue[i]); } new Login();//打开登录页面 this.dispose();//当前界面关闭 } } ~~~