JFace

title: "JFace" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["eclipse-technology", "eclipse-software", "articles-with-example-java-code", "software-using-the-eclipse-public-license"] topic_path: "general/eclipse-technology" source: "https://en.wikipedia.org/wiki/JFace" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::data[format=table title="Infobox software"]
| Field | Value |
|---|---|
| screenshot | [[File:EclipseScreenshot.png |
| caption | The Eclipse IDE, a JFace-based application |
| developer | Eclipse Foundation |
| latest release version | 3.9.1 |
| latest release date | |
| operating system | Cross-platform |
| language | Multilingual |
| genre | widget toolkit for the Java platform |
| license | Eclipse Public License |
| website | |
| :: |
| logo = | screenshot = [[File:EclipseScreenshot.png|frameless]] | caption = The Eclipse IDE, a JFace-based application | developer = Eclipse Foundation | latest release version = 3.9.1 | latest release date = | latest preview version = | latest preview date = | operating system = Cross-platform | language = Multilingual | genre = widget toolkit for the Java platform | license = Eclipse Public License | website =
JFace is defined by the Eclipse project as "a UI toolkit that provides helper classes for developing UI features that can be tedious to implement." The Standard Widget Toolkit (SWT) is an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.
Structure
It is a layer that sits on top of the raw widget system, and provides classes for handling common UI programming tasks. It brings model view controller programming to the Standard Widget Toolkit.
- Provides Viewer classes that handle the tedious tasks of populating, sorting, filtering, and updating widgets
- Provides Actions to allow users to define their own behavior and to assign that behavior to specific components, e.g. menu items, tool items, push buttons, etc.
- Provides registries that hold Images and Fonts
- Defines standard dialogs and wizards, and defines a framework for building complex interactions with the user
- Its primary goal is to free the developer up, letting the developer focus on the implementation of his or her specific application without having to be concerned with the underlying widget system or solving problems that are common in almost all UI applications.
- A primary concern of the Eclipse group when developing JFace was that under no circumstances did they want to hide the SWT component implementation from the programmer. JFace is completely dependent on SWT, but SWT is not dependent on JFace. Furthermore, the Eclipse Workbench is built on both JFace and SWT; in some instances, it bypasses JFace and accesses SWT directly.
Example
The following is a basic Hello World program using JFace. ::code[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; } } ::
References
Bibliography
- {{citation | first1 = Matthew | last1 = Scarpino | first2 = Stephen | last2 = Holder | first3 = Stanford | last3 = Ng | first4 = Laurent | last4 = Mihalkovic | date = November 28, 2004 | title = SWT/JFace in Action: GUI Design with Eclipse 3.0 | edition = 1st | publisher = Manning Publications | pages = 496 | isbn = 1-932394-27-3 | url =
- {{citation |first1 = Jackwind |last1 = Li Guojie |date = February 11, 2005 |title = Professional Java Native Interfaces with SWT/JFace |edition = 1st |publisher = Wrox Press |pages = 528 |isbn = 0-470-09459-1 |url = http://www.wrox.com/WileyCDA/WroxTitle/Professional-Java-Native-Interfaces-with-SWT-JFace.productCd-0470094591.html |access-date = July 21, 2009 |archive-date = December 26, 2014 |archive-url = https://web.archive.org/web/20141226112003/http://www.wrox.com/WileyCDA/WroxTitle/Professional-Java-Native-Interfaces-with-SWT-JFace.productCd-0470094591.html |url-status = dead
- {{citation |first1 = Robert |last1 = Harris |first2 = Rob |last2 = Warner |date = June 21, 2004 |title = The Definitive Guide to SWT and JFACE |edition = 1st |publisher = Apress |pages = 684 |isbn = 1-59059-325-1 |url = http://www.apress.com/book/view/9781590593257 |access-date = July 21, 2009 |archive-url = https://web.archive.org/web/20090731134202/http://www.apress.com/book/view/9781590593257 |archive-date = July 31, 2009 |url-status = dead
References
- [http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/jface.htm Eclipse programmer's guide entry on JFace]
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::