Skip to content

JFace Tutorial : Application Window Example

package com.deveshcodelab.examples.swt;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;

public class SWTJFaceSnippet02 extends ApplicationWindow {
	public SWTJFaceSnippet02() {
		super(null);
	}

	protected Control createContents(Composite parent) {
		Label helloText = new Label(parent, SWT.CENTER);
		helloText.setText("Hello SWT and JFace!");
		parent.pack();
		return parent;
	}

	public static void main(String[] args) {
		SWTJFaceSnippet02 awin = new SWTJFaceSnippet02();
		awin.setBlockOnOpen(true);
		awin.open();
		Display.getCurrent().dispose();
	}

}

Leave a Reply

Your email address will not be published. Required fields are marked *