eclipse插件教程-弹出界面框

package com.youhua.link.actions;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Display display = new Display();
		Shell shell = new Shell(display);
		
		shell.setText("hello");
		shell.setBounds(100,100,200,50);
		shell.setLayout(new FillLayout());
		
		Label label = new Label(shell,SWT.CENTER);
		label.setText("fd");
		
		Color red = new Color(display,255,0,0);
		label.setForeground(red);
		
		shell.open();
		
		while(!shell.isDisposed()){
			if(!display.readAndDispatch()){
				display.sleep();
			}
		}
		
		red.dispose();
		display.dispose();
		
	}

}



利用SWT组件,单独编写一个框,该弹框可以独立运行。

你可能感兴趣的:(eclipse插件教程-弹出界面框)