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

📄 threadview.java

📁 一个基于eclipse插件开发的聊天程序
💻 JAVA
字号:
package talkServer;

import java.io.IOException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;

import talkServer.business.ListeningThread;

public class ThreadView extends ViewPart {

	public static final String ID = "talkServer.ThreadView";

	public Text text;
	
	// THREAD HANDLER
	ListeningThread listeningThread;

	public ThreadView() {
		super();
	}

	public void createPartControl(Composite parent) {
		Composite top = new Composite(parent, SWT.NONE);
		top.setLayout(new GridLayout());
		GridData gridData = new GridData(GridData.FILL_HORIZONTAL
				| GridData.FILL_VERTICAL);
		text = new Text(top,SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
		text.setLayoutData(gridData);
	}

	public void setFocus() {
	}

	public void init(IViewSite site) throws PartInitException {
		super.init(site);
	}

	public void dispose() {
		super.dispose();
		// STOP THE THREAD
		listeningThread.stop();
		// CLOSE THE LISTENING SOCKET
		try {
			listeningThread.server_sock.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		// listeningThread.destroy();
		System.out.println("Listening end.");
	}

}

⌨️ 快捷键说明

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