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

📄 error_m.java

📁 JAVA实现的页面调度管理
💻 JAVA
字号:
package com.os.lyc;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.swtdesigner.SWTResourceManager;

public class Error_M extends Dialog {
    public static int kind=0;
	protected Object result;
	protected Shell shell;

	/**
	 * Create the dialog
	 * @param parent
	 * @param style
	 */
	public Error_M(Shell parent, int style) {
		super(parent, style);
	}

	/**
	 * Create the dialog
	 * @param parent
	 */
	public Error_M(Shell parent) {
		this(parent, SWT.NONE);
	}

	/**
	 * Open the dialog
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		return result;
	}

	/**
	 * Create contents of the dialog
	 */
	protected void createContents() {
		shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
		shell.setSize(341, 150);
		shell.setText("SWT Dialog");

		final Label label = new Label(shell, SWT.NONE);
		label.setForeground(SWTResourceManager.getColor(255, 0, 0));
		label.setFont(SWTResourceManager.getFont("", 12, SWT.NONE));
		
		label.setBounds(10, 18, 315, 43);
		switch(kind){
		case 1:label.setText("请输入所要申请的内存大小!");break;
		case 2:label.setText("请输入正确的数据(正整数)!");break;
		case 3:label.setText("请输入进程名!");break;
		case 4:label.setText("该进程名已被使用,请更换!");break;
		case 5:label.setText("申请空间大于剩余空间!");break;
		default:label.setText("错误!");
		}

		final Button button = new Button(shell, SWT.NONE);
		button.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(final SelectionEvent e) {
				shell.close();
			}
		});
		button.setText("确定");
		button.setBounds(147, 70, 48, 22);
		//
	}

}

⌨️ 快捷键说明

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