JFace
| Company type | Software framework |
|---|---|
| Industry | Software development |
| Founder | Eclipse Foundation |
| Products | UI framework for Java |
| Website | www |
JFace is characterized by the Eclipse initiative as a UI framework that delivers auxiliary classes to simplify the development of UI components that are otherwise complex to create. The Standard Widget Toolkit (SWT) represents an open-source Java widget library crafted to provide fast, cross-platform access to native user interface elements.
Structure
Positioned above the fundamental widget layer, JFace supplies classes that facilitate routine UI programming responsibilities and seamlessly combine model-view-controller architecture with SWT.
Its features include:
- Viewer classes responsible for managing widget population, sorting, filtering, and refreshing
- Actions that allow developers to assign functionality to elements such as menus and buttons
- Registries dedicated to managing Images and Fonts
- Predefined standard dialogs and wizards, alongside a framework supporting intricate user workflows
The main objective of JFace is to enable developers to concentrate on application-specific logic without handling the intricacies of the widget system or common UI programming difficulties. Importantly, the Eclipse team designed JFace so that it does not obscure SWT; JFace relies on SWT, but SWT operates independently of JFace. The Eclipse Workbench utilizes both layers, occasionally invoking SWT directly for enhanced efficiency.
Example
An elementary "Hello, World" application implemented with JFace: <syntaxhighlight lang="java"> import org.eclipse.jface.window.ApplicationWindow; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*;
public class HelloWorld extends ApplicationWindow {
public static void main(String[] args) {
new HelloWorld().run();
}
public HelloWorld() {
super(null);
}
public void run() {
setBlockOnOpen(true);
open();
Display.getCurrent().dispose();
}
protected Control createContents(Composite parent) {
Label label = new Label(parent, SWT.CENTER);
label.setText("Hello, World");
return label;
}
} </syntaxhighlight>
See also
Bibliography