如何在工作结束后处理进度条

时间:2014-12-12 10:40:26

标签: java swt

我必须在点击“确定”时显示进度条。键.. 如果'确定'单击按钮将打开另一个shell窗口

我的代码也显示了该过程后的进度。如何在另一个shell窗口打开后配置进度条?

这是我显示progess栏的代码..

        public class PV6 
        {   public static final String Pv6 = null;
            static Shell shell = null;
            public static void Pv6(Button ok, Shell shell2) 
            {
                shell=shell2;

                final ProgressBar pb2 = new ProgressBar(shell, SWT.SMOOTH);

                shell.setLayout(new RowLayout()); 
                shell.setSize(1500, 1000);

                pb2.setSelection(500);
                pb2.setBounds(840, 680, 150, 14);


                Label label2 = new Label(shell, SWT.NULL);
                //label2.setText("Success");
                label2.setAlignment(SWT.LEFT);
                label2.setBounds(10, 40, 80, 20);
    }
    }

这是我的主要计划

    public class Practice1 
    {
        static Text text = null;
        final static Shell shell = null;

        public static void main (String [] args) 
        {
            final Display display =new Display();
            final Shell shell=new Shell(display);
            RowLayout rowLayout = new RowLayout();
            shell.setLayout(rowLayout);
             Label label = new Label (shell, SWT.NONE);
        label.setText ("Enter the text:");

        text = new Text (shell, SWT.BORDER);

        final Button ok = new Button (shell, SWT.PUSH);
        ok.setText ("OK");
        ok.addSelectionListener(new SelectionAdapter() 
        {
            @Override
            public void widgetSelected(SelectionEvent e) 
            {

                PV6.Pv6(ok,shell);
                System.out.println(text.getText()); 
            }
        });
    ok.addSelectionListener (new SelectionAdapter () 
        {

            @Override
public void widgetSelected (SelectionEvent e) 
            {
    final Shell dialog = new Shell (shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
                dialog.setText("Dialog Shell");
                dialog.setBounds(50,100, 10, 10);
                FormLayout formLayout = new FormLayout ();
                formLayout.marginWidth = 10;
                formLayout.marginHeight = 10;
    dialog.setLayout (formLayout);

                Label label = new Label (dialog, SWT.NONE);
                label.setText ("Type a Name:");
                FormData data = new FormData ();
                label.setLayoutData (data);

                Button cancel = new Button (dialog, SWT.PUSH);
                cancel.setText ("Cancel");

                data = new FormData ();
                data.width = 60;
                data.right = new FormAttachment (100, 0);
                data.bottom = new FormAttachment (100, 0);

                cancel.setLayoutData (data);
                cancel.addSelectionListener (new SelectionAdapter () 
                {
                    @Override
                    public void widgetSelected (SelectionEvent e) 
                    {

                        System.out.println("User cancelled dialog");
                        dialog.close ();
                    }
                });
dialog.setDefaultButton (ok);
                        dialog.pack ();
                        dialog.open ();
    shell.pack ();
        shell.open ();

        while (!shell.isDisposed ())
        {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
    }

如何在另一个窗口打开后处理进度查看器?

任何人都可以帮我这个..? 在此先感谢!!

0 个答案:

没有答案