Java Tutorial/SWT/JFace Introduction
Версия от 17:44, 31 мая 2010; (обсуждение)
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
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;
}
}
If parentShell is null, the ApplicationWindow represents a top-level window. Otherwise, it"s a child of parentShell.