Java Tutorial/SWT/JFace Introduction
17. Required JFace JAR files:
jface.jarin org.eclipse.jface_X.X.Xruntime.jarin org.eclipse.core.runtime_X.X.Xosgi.jarin org.eclipse.osgi_X.X.Xjfacetext.jarin org.eclipse.jface.text_X.X.Xtext.jarin org.eclipse.text_X.X.X
17. Your first JFace application
<source lang="java">
import org.eclipse.jface.window.ApplicationWindow; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.ruposite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; public class ApplicationWindowJFrace {
public static void main(String[] args) { new MainWindow(); }
} class MainWindow extends ApplicationWindow {
public MainWindow() { super(null); // Don"t return from open() until window closes setBlockOnOpen(true); // Open the main window open(); // Dispose the display Display.getCurrent().dispose(); } protected Control createContents(Composite parent) { // Create a Hello, World label Label label = new Label(parent, SWT.CENTER); label.setText("www.jexp.ru"); return label; }
}</source>
If parentShell is null, the ApplicationWindow represents a top-level window. Otherwise, it"s a child of parentShell.