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

📄 readwindow.java

📁 PIMailReader 基于RCP eclipse的邮件接收小程序
💻 JAVA
字号:
package net.sf.pim.mail.reader;

import java.io.FileInputStream;

import javax.mail.internet.MimeMessage;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class ReadWindow extends ApplicationWindow {

	private FileMessageReader messageReader;
	private ReadAction readAction;

	public ReadWindow(Shell parentShell) {
		super(parentShell);
		setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
		setBlockOnOpen(true);
		makeActions();
	}
	private void makeActions() {
		addToolBar(SWT.FLAT);
		readAction = new ReadAction();
		readAction.setReadWindow(this);
		getToolBarManager().add(readAction);
	}
	
	protected void configureShell(Shell shell) {
    	super.configureShell(shell);
        shell.setText("外部邮件");
   }

    protected Point getInitialSize() {
		return new Point(640, 480);
	}
	
	@Override
	protected Point getInitialLocation(Point initialSize) {
		Point p=super.getInitialLocation(initialSize);
		//让弹出窗口在主窗口的下方,缺省在上方
		return new Point(p.x,p.y*2);
	}
	@Override
	public Control createContents(Composite parent) {
		messageReader = new FileMessageReader(parent,SWT.NULL);
		parent.layout();
		return messageReader;
	}
	
	public void ShowMessage(String fname){
		try{
			MimeMessage mm=new MimeMessage(null,new FileInputStream(fname));
			mm.setHeader("FILE_FULL_NAME", fname);
			messageReader.showMessage(mm);
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

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