⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.java

📁 一个java swt的线程例子 用滚动的进度条显示线程 直观 对初学者有点用处.
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -