Border's log

--- java FreeBsd Web3D open-sources

一个简单的进度条,applet实现
package com.border;

import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.*;


class Show extends JFrame{
        int num;
        JProgressBar current;

        public Show(int fileCount){
                super("Showtime by border...");
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                JFrame.setDefaultLookAndFeelDecorated(true);

                this.setResizable(false);
                this.setLocation(250,280);
                JPanel  p1=new JPanel();

                p1.setLayout(new FlowLayout(FlowLayout.CENTER));
                p1.setPreferredSize(new Dimension (550,40));
                JProgressBar progressBar = new JProgressBar (0,fileCount);
                progressBar.setPreferredSize(new Dimension (500,30));

                current = progressBar;
                current.setStringPainted(true);
                p1.add(current);

                setContentPane(p1);

        }
        public String iterate(int fileCount) {
                String fla = null;
                while(num<fileCount){
                                current.setValue(num);
                        try{
                                Thread.sleep(4000);
                         }catch(InterruptedException ee){}
                        num+=1;
                        System.out.println(num);
                        if(num>=fileCount){
                                fla="true";
                         }
                }
//              System.out.println(fla);
                return fla;
                }
}

public class ShowTime {
        public static void main(String[] age){
                int fileCount = 10;
                String tt;
                Show test=new Show(fileCount);
                test.pack();
                test.setVisible(true);
                tt=     test.iterate(fileCount);
                if(tt.equals("true")){
                        test.setVisible(false);
                 }
        }
}


下载代码:http://borderj.googlepages.com/ShowTime.rar
阅读更多
个人分类: Java
想对作者说点什么? 我来说一句

java的applet进度条表格示例

2013年03月27日 17KB 下载

没有更多推荐了,返回首页

不良信息举报

一个简单的进度条,applet实现

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭