<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    DANCE WITH JAVA

    開(kāi)發(fā)出高質(zhì)量的系統(tǒng)

    常用鏈接

    統(tǒng)計(jì)

    積分與排名

    好友之家

    最新評(píng)論

    Swt/Jface進(jìn)度條

    處理長(zhǎng)時(shí)間的任務(wù)的時(shí)候常需要進(jìn)度條顯示,有幾種實(shí)現(xiàn)方式
    1,普通的進(jìn)度條
    import java.lang.reflect.InvocationTargetException;

    import org.eclipse.core.runtime.IProgressMonitor;
    import org.eclipse.jface.dialogs.ProgressMonitorDialog;
    import org.eclipse.jface.operation.IRunnableWithProgress;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;


    public class TestProgress {
        
    static boolean stopflg = false;
        
    /**
         * Launch the application
         * 
    @param args
         
    */

        
    public static void main(String[] args) throws Exception{
            
    final Display display = Display.getDefault();
            
    final Shell shell = new Shell();
            shell.setSize(
    500375);
            shell.setText(
    "SWT Application");
            
            
    //
            IRunnableWithProgress runnable = new IRunnableWithProgress(){
                
    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask(
    "generate"30);
                    
    for(int i=0;i<100;i++){
                        
    if(monitor.isCanceled()){
                            
    return;
                        }

                        monitor.worked(
    1);
                        Thread.sleep(
    50);
                    }

                    
                    monitor.done();
                }

            }
    ;
            
    new ProgressMonitorDialog(shell).run(truetrue, runnable);
            shell.open();
            shell.layout();
            
    while (!shell.isDisposed()) {
                
    if (!display.readAndDispatch())
                    display.sleep();
            }

        }


    }

    2,反復(fù)循環(huán)的進(jìn)度條
    import java.lang.reflect.InvocationTargetException;

    import org.eclipse.core.runtime.IProgressMonitor;
    import org.eclipse.jface.dialogs.ProgressMonitorDialog;
    import org.eclipse.jface.operation.IRunnableWithProgress;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;


    public class TestProgress {
        
    static boolean stopflg = false;
        
    /**
         * Launch the application
         * 
    @param args
         
    */

        
    public static void main(String[] args) throws Exception{
            
    final Display display = Display.getDefault();
            
    final Shell shell = new Shell();
            shell.setSize(
    500375);
            shell.setText(
    "SWT Application");
            
            
    //
            IRunnableWithProgress runnable = new IRunnableWithProgress(){
                
    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    monitor.beginTask(
    "generate"30);
                    
    int i=0;
                    
    while(true){
                        
    if(stopflg){
                            
    break;
                        }

                        i
    ++;
                        
    if(i==30){
                            i
    =0;
                            monitor.beginTask(
    "generate"30);
                        }

                        monitor.worked(
    1);
                        Thread.sleep(
    100);
                    }

                    monitor.done();
                }

            }
    ;
            
    new ProgressMonitorDialog(shell).run(truetrue, runnable);
            shell.open();
            shell.layout();
            
    while (!shell.isDisposed()) {
                
    if (!display.readAndDispatch())
                    display.sleep();
            }

        }


    }

    3,rcp中后臺(tái)任務(wù)的進(jìn)度條
    使用Job建立后臺(tái)任務(wù),只需要設(shè)置job.setUser(true)進(jìn)度條就出現(xiàn)了,和上邊一樣,進(jìn)度條需要自己來(lái)控制進(jìn)度。如果做一個(gè)cool的進(jìn)度條,就看你如何讓進(jìn)度條顯示出實(shí)際的任務(wù)進(jìn)程。

    posted on 2007-08-10 09:59 dreamstone 閱讀(5036) 評(píng)論(0)  編輯  收藏 所屬分類: SWT和插件開(kāi)發(fā)

    主站蜘蛛池模板: 日本亚洲色大成网站www久久| 日韩免费视频播播| 亚洲不卡中文字幕无码| 日本高清免费中文在线看| 亚洲成aⅴ人片久青草影院| 国产产在线精品亚洲AAVV| 国产自产拍精品视频免费看| 亚洲人6666成人观看| 妻子5免费完整高清电视| 亚洲乱码一二三四区麻豆| 无码国产精品一区二区免费I6| 亚洲av乱码一区二区三区| 女人18毛片水真多免费播放| 美女又黄又免费的视频| 亚洲成aⅴ人片久青草影院| 黄色网页在线免费观看| 亚洲国产美女精品久久久久∴| 国产精品区免费视频| 亚洲国产午夜精品理论片 | 色窝窝亚洲av网| 少妇亚洲免费精品| 麻豆亚洲av熟女国产一区二| 一级女人18毛片免费| 亚洲美国产亚洲AV| 亚洲免费日韩无码系列| 国产亚洲情侣久久精品| 中文字幕精品亚洲无线码二区| 久久久国产精品无码免费专区| 色偷偷亚洲女人天堂观看欧| 免费成人午夜视频| 99精品视频免费观看| 亚洲欧美日韩中文二区| 亚洲中文字幕无码爆乳AV| 亚洲毛片在线免费观看| 羞羞视频在线免费观看| 亚洲人成网站在线播放影院在线| 妞干网免费观看视频| 国产麻豆一精品一AV一免费 | 国产在线19禁免费观看| 成在人线av无码免费高潮喷水| 亚洲情A成黄在线观看动漫软件|