thread.java

来自「一个java swt的线程例子 用滚动的进度条显示线程 直观 对初学者有点用」· Java 代码 · 共 78 行

JAVA
78
字号
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;


public class thread {

	private Spinner spinner_1;
	private Scale scale;
	private ProgressBar progressBar;
	public Button button;
	public Button button_1;
	public Button button_2;
	public Button button_3;
	public Button button_4;
	public Button button_5;
	public Button button_6;
	public Button button_7;
	protected Shell shell;
	public Group group;
	public Spinner spinner;
//	Mythread mythread;
	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			thread window = new thread();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window
	 */
	public void open() {
		final Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	/**
	 * Create contents of the window
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setLayout(new GridLayout());
		shell.setSize(500, 375);
		shell.setText("SWT Application");
		threadtest[] tt=	new threadtest[6];
		for (int i = 0; i < tt.length; i++) {
			tt[i]=new threadtest();
		}	
		for (int i = 0; i < tt.length; i++) {
			tt[i].oo(shell);
		}	
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?