The Standard Widget Toolkit supplies Java widgets, events, layouts and graphics backed by the host desktop platform. It powers Eclipse and can also be used by standalone JVM applications. Start here for a native widget, event-loop, JNI or resource-lifetime problem; use Platform UI for JFace viewers and workbench parts.
Source map · Concepts · Quickstart · Android and iOS preview · Example · Development guide · Release preparation and coverage · Fork release-readiness gates · Candidate packaging and naming · Release preparation and suite inventory
This fork also contains a bounded mobile implementation of the original SWT
Display, Shell, Control, Canvas, graphics and event-loop owners, with
Button, Label, ProgressBar, Scale, List, native-editor Text and Combo source
sets. Start with the mobile build and scope guide and its
explicit source manifest.
- Shared mobile SWT owners retain widget state, listeners, layouts and resource lifetime.
- Android platform binding supplies the Activity/View/Canvas and EditText integration. The current application minimum is Android 15 / API 35.
- iOS platform binding and UIKit/JNI owner have a separate Apple build and runtime route.
- Nebula's RoundedCheckbox mobile application
uses the original Nebula widget and these SWT controls. Its current build is
in the widget's
android/directory.
The mobile guide documents the JDK 21 / Maven source build, portable contract tests, Android SDK 35 integration and iOS Java/native compilation. Its explicit source manifest rejects an unreviewed source change; use a revision whose source pins have been qualified together. Device instrumentation is a separate gate. This preview does not cover every SWT or Nebula widget, bundle an iOS Java runtime, or establish accessibility, IME or full platform parity through compilation alone.
| Area | What it owns |
|---|---|
| Main SWT bundle | Shared APIs and platform-specific widget implementations |
| Native development notes | JNI and host-specific native build routes |
| binaries/ | OS/window-system/architecture-specific native fragments |
| Snippets | Small runnable API demonstrations and reproductions |
| tests/ | Common tests and backend-specific test fragments |
| SWT tools | JNI generation and developer tooling |
The same widget name can have different GTK, Win32 and Cocoa implementations. Find the actual host backend before explaining behavior from a source file.
- Display: owns the UI event context and dispatch loop.
- Shell / Control: a top-level window and the base abstraction for controls.
- Listener: responds to a widget event; layout determines geometry separately.
- UI-thread affinity: widget operations normally belong on the owning display
thread.
asyncExecschedules UI work; it does not keep a control alive. - Native fragment / JNI: matching platform libraries and the Java/native boundary. Java compilation alone does not prove the native library can load.
- Owned / borrowed resource: application-created
GCandImageobjects need cleanup; borrowed paint-event or framework-owned resources must not be disposed as though the application created them.
This fork is an optimized superset of its supported upstream SWT subsets. Applications using those subsets must retain their API, behavior, event ordering, item identity, threading and disposal contracts when run on the fork. Integration must also preserve existing fork extensions and optimizations; replacing them with upstream-only implementations is not convergence. Compatibility is directional: an upstream subset need not provide APIs added by this fork. Release qualification tests both inherited contracts and retained extensions on each claimed platform.
This is an experimental downstream fork of Eclipse SWT. The checkout contains SWT APIs/backends, fork-specific implementation work such as ItemBitSet, and M3 recipe/inventory tooling. Source presence is not a claim that every backend, default model or optimization is qualified. The development guide distinguishes native rendering, visible-screen evidence, behavior tests and independent resource measurements. Upstream releases and badges below describe their linked upstream projects. The SWT M3 release contract fixes the naming, test-selection and platform-evidence requirements for this fork. Its Windows/macOS CI archive is a candidate package; Linux and executed test evidence are separate gates.
For application adoption, follow the original platform-specific JAR and Hello World example below. For source development, the inspected matrix checks Java 21 and Java 25 and the build workflow selects Maven 3.9.16. Install/configure Git LFS before cloning if using precompiled native binaries, or follow the host-native build guide. You also need native dependencies and a working display for GUI tests.
git clone https://github.com/hsoliwal/eclipse.platform.swt.git
cd eclipse.platform.swt
git rev-parse HEAD
git lfs ls-files
java -version
mvn -version
mvn clean verifyThis is a source-checked build route, not a test receipt. LFS pointer files are not usable native binaries, and packaging multiple fragments does not execute tests on all of their platforms.
# Artifact-only build; does not establish test success.
mvn clean verify -DskipTests
# Native verification on a provisioned Linux x86_64 GTK host only.
mvn clean verify -Dnative=gtk.linux.x86_64
# Find the smallest event-loop reproductions.
git grep -n 'readAndDispatch' -- examples/org.eclipse.swt.snippets- Invalid thread access: trace the caller and display ownership first.
- Disposed widget in delayed work: check liveness inside the dispatched callback and coordinate display shutdown with workers.
- Native load failure: check OS, CPU, resolved LFS objects and fragment match.
- JNI changes: use the documented generator, review its diff and build the matching native library. Do not hand-edit generated glue or commit local binaries.
Open, resize and close a minimal window. Read Snippet1.java in a configured SWT workspace:
- A standalone application creates its
Displayand aShell. shell.open()makes the window available for interaction.readAndDispatch()processes events;sleep()waits when there are none.- Closing the shell ends the loop; the application disposes the display it owns.
- Add the README's button/text example only after that lifecycle works. Keep listeners short and check repeated open/close behavior on the real backend.
The workbench owns its display, so a plug-in must not copy standalone teardown blindly. This is an exploration to run, not evidence of a new native/UI test pass. Continue with the development guide, Linux, Windows or macOS setup and CONTRIBUTING.md. Existing fork/upstream material follows.
Source tour checked at
9cc0683c4925. Commands describe that revision; recheck build configuration when changing revisions. Build/UI/performance verification was not run for this README update.
Native desktop widgets are where runtime ideas meet real UI contracts.
Note
This is an experimental downstream fork of the upstream SWT project. M3 String, regex, precompute and collection integration are engineering directions, not verified deployment, performance, compatibility or upstream-endorsement claims. Preserve original licensing, copyright, API behavior and native/UI contracts.
| Surface | What to investigate | Non-negotiable contract |
|---|---|---|
| Events and input | Measure event-dispatch latency and repeated text work | UI-thread affinity and event ordering |
| Native boundaries | Study JNI/native transitions and canonical shared data | SWT platform behavior and resource lifecycle |
| Widget resources | Measure allocation, retained memory, disposal and steady-state responsiveness | No leaks, regressions or changed public APIs |
Approach: inventory first; copy/derive only with license and provenance; qualify reusable recipes in Synexia; port into the appropriate runtime/product owner; then test with representative desktop projects and publish CPU, allocation, retained-memory, startup and responsiveness numbers, including regressions. No Synexia runtime dependency.
Java, JNI, SWT, workbenches, widgets, real code: open the repositories. Bring a failing case, a performance counterexample, a profiler trace or a better algorithm. Challenge the design on the merits of source, tests and evidence—not slogans or a résumé.
Explore the family: M3JDK21 · SWT · Eclipse Platform · Platform UI · Nebula · GEF Classic.
Contribute here: issues · pull requests · M3 compatibility and benchmark contract.
The remainder of this README retains the existing M3 fork notes and the original upstream SWT documentation. Nothing in this introduction rebrands upstream work as M3-authored code.
M3 is based on the idea that shared immutable structure and indexed metadata can provide a basis for reusable computation. The programme starts with M3 String, regex, and precompute in M3JDK21, then collections and SWT/Eclipse integration.
This SWT fork is a target for exploring qualified runtime and collection improvements at the desktop toolkit boundary, with widget behavior, native integration, and responsiveness remaining central.
Explore the idea: M3 technical design paper · Programme goals and roadmap. The paper explains the proposed architecture, cost tradeoffs, and evaluation plan. Readers are invited to examine the work and contribute representative workloads.
This section describes the direction of the hsoliwal fork. Upstream documentation follows below; upstream authorship, licenses, and project identity remain intact.
SWT is a cross-platform GUI library for JVM based desktop applications. The best known SWT-based application is Eclipse.
For more information about SWT, visit the official SWT page.
SWT comes with platform-specific jar files. Download them from https://download.eclipse.org/eclipse/downloads and add the jar file to your classpath.
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class HelloWorld {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Hello World");
shell.setLayout(new GridLayout(2, false));
final Label label = new Label(shell, SWT.LEFT);
label.setText("Your &Name:");
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
final Text text = new Text(shell, SWT.BORDER | SWT.SINGLE);
final GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
data.minimumWidth = 120;
text.setLayoutData(data);
final Button button = new Button(shell, SWT.PUSH);
button.setText("Say Hello");
shell.setDefaultButton(button);
button.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false, 2, 1));
final Label output = new Label(shell, SWT.CENTER);
output.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
button.addListener(SWT.Selection, event -> {
String name = text.getText().trim();
if (name.length() == 0) {
name = "world";
}
output.setText("Hello " + name + "!");
});
shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}First, a Display is created which is something like the central place of all GUI-related code.
Then a Shell is created which in our example is a top-level window.
Then all child controls and listeners are created, including their layout information.
Finally, we set the window's size determines by its child controls and open the window.
The while-loop processes all GUI related events until the shell is disposed which happens when closing.
Before exiting, any claimed GUI resources needs to be freed.
Thanks for your interest in this project.
For information about contributing to Eclipse Platform in general, see the general CONTRIBUTING page.
- bundles/org.eclipse.swt/ owns SWT Java code and the platform-specific JNI sources. Its development overview explains the Java/native split and JNI regeneration
- binaries/ contains fragments selected by window system, OS and architecture. Use the fragment matching the machine on which you run SWT
- snippets are small reproductions; examples are larger demonstrations
- tests/ contains the common SWT test bundle and native-platform test fragments. The root POM selects the platform-specific test modules
The current matrix workflow is configured for JDK 21 and JDK 25; API/Javadoc checks use selected JDK 25 legs. Its build workflow selects Maven 3.9.16. Use those checked-in values to reproduce that lane. Older platform notes include historical JDK versions and last-tested dates; they are not a promise that the current reactor builds with those older JDKs. .mvn/maven.config enables the individual-bundle profile, which resolves the Eclipse parent through the repository configured in pom.xml.
Before rebuilding native code, read the guide for the actual host platform:
- Linux/GTK: make, a C compiler and the matching GTK development files; the GTK development guide has additional detail
- Windows/Win32: Visual Studio C++ build tools and the Windows SDK
- macOS/Cocoa: Xcode Command Line Tools
The build workflow records additional Linux libraries and the display-session setup used by CI. GUI tests need an appropriate display backend: its X11 lane uses Xvfb and its Wayland lane uses a headless Mutter session. A successful build on one OS/backend does not qualify another.
Native declarations and generated JNI C sources must stay in sync. Follow the JNI regeneration instructions instead of editing generated glue by hand. Keep compiled native binaries out of contributions, as described below.
Fork-specific work goes to hsoliwal/eclipse.platform.swt pull requests. The upstream contribution links and Oomph setup above remain the route for upstream SWT work; verify the workspace's remote before editing. Include the OS, architecture, GTK/display backend where applicable, exact build command and test reports in a bug report or PR. Mark unrun native/UI checks explicitly.
The architecture and coverage guide connects source-backed lifecycle contracts, project/module ownership, Java package and source-set coverage, and export boundaries. It pins the inspected source revision and keeps unreviewed semantics, generated or native boundaries, and unrun verification visible. Inventory coverage is reported separately from complete package/API documentation.
The SWT source code is stored in this Git repository.
This repository uses the Git Large File Storage (LFS) extension to host also the precompiled SWT native binaries, which is therefore required unless binaries are compiled locally.
When using Git from the CLI follow the Git LFS installation and setup instructions:
When using EGit from within Eclipse follow the EGit user guide on GIT LFS Support:
Note:
Changes to the binary artifacts must not be committed, as the binaries are compiled only in the Eclipse infrastructure.
To build all SWT artifacts and to run all tests, execute at the CLI from the repository root:
mvn clean verifyTo build only the artifacts, without testing, run
mvn clean verify -DskipTestsFor instructions on building the native binaries of SWT see the section Building native binaries.
See the following description for how to contribute a feature or a bug fix to SWT.
Information regarding source code management, builds, coding standards, and more can be found under the following link.
Also see in the SWT section of the Eclipse FAQ for more background information about SWT.
Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).
Contact the project developers via GitHub:
- GitHub Discussions - For questions and general discussions
- GitHub Issues - For bug reports and feature requests
You can register bugs and feature requests in the GitHub Issue Tracker. Remember that contributions are always welcome!
Please bear in mind that this project is almost entirely developed by volunteers. If you do not provide the implementation yourself (or pay someone to do it for you), the bug might never get fixed. If it is a serious bug, other people than you might care enough to provide a fix.
Note: SWT used to track ongoing development and issues in Bugzilla, but we now use GitHub Issues and Discussions.
In project Initiative 31 an evaluation on the feasibility of implementing SWT in an OS-agnostic way based on a cross-platform graphics/widgets library has been conducted. The goal was to assess if the existing three implementations could eventually be replaced by an OS-agnostic one in order to reduce maintenance efforts, enable highly customizable look and feel, and improve configurability. A demonstrator based on the graphics library Skia was implemented and multiple prototypes for mitigating risks have been implemented, such that bringing that to a production-ready implementation is a matter of effort but not of conceptual or technical/technological risk.
The actual prototyping work has started on four technologies: Skia with Visual Class Library (VCL), Skia with custom-implemented widgets, GTK, and Swing
All those prototypes can be found in the according GitHub organization: https://github.com/swt-initiative31
The work finally focused on the Skia graphics library with custom-implemented widgets: https://github.com/swt-initiative31/prototype-skija
The project concluded with the feasibility demonstration and a report summarizing the results. Given sufficient resources, a follow-up project could convert the demonstrator into a production-ready state.
For a source map, current build prerequisites, command cheat sheet and a worked event-loop tour, see the SWT development guide.
Condensed notes from donor commit 95b4bef5978 ("doc(): clear notes"), carried verbatim with headings demoted; the sections above stay the canonical text.
- Eclipse SWT
- == cross-platform GUI library -- for -- JVM based desktop applications
- -> includes platform-specific ".jar"
- Example: Eclipse
- 👀ALMOST ENTIRELY developed -- by -- volunteers 👀
- == cross-platform GUI library -- for -- JVM based desktop applications
-
steps
- download it here
- add the ".jar" | YOUR classpath
-
Example:
- TODO: How to create a NEW Eclipse project?
- follow Eclipse Platform's CONTRIBUTING
- steps
- create a Eclipse Development Environment -- link --
- see Eclipse FAQ
- see Bugzilla
- see here
- Reasons: 🧠
- reduce maintenance efforts,
- enable better look and feel
- improve configurability 🧠
- technologies suggested
- Skia with Visual Class Library (VCL),
- Skia + custom-rendered widgets,
- GTK,
- Swing
Superset note (donor-resolve 2026-10-31): the section below is the donor's README, appended verbatim after its first heading. In this superset the
org.eclipse.swt.gtk.win32.x86_64fragment is carried as a source project and is not in the Maven reactor (binaries/pom.xmland the rootpom.xmlare unchanged); it is selected with the window systemgtk(Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=win32) (osgi.arch=x86_64)), launch with-ws gtk) instead of claimingosgi.ws=win32, and theorg.eclipse.swt.win32.win32.x86_64fragment keeps itsosgi.os=win32filter, so the win32 port (viewport default) is never displaced. The TreeItem image tweak is superseded by our TreeItem, which returns images from its per-column cache (cellImage, viewportvirtualImages) instead of reading the model surface back; the splash-shell tweak applies only whenOS.IsWin32. The fragment's natives are revisions 4965r11/4967r8; a GTK-on-Windows native build at 4975r19 is needed before use.
This branch prototypes the usage of GTK for rendering SWT on Windows. It is based on work done some years ago: https://bugs.eclipse.org/bugs/show_bug.cgi?id=488431
To provide GTK on Windows, you best follow the official GTK documentation: https://www.gtk.org/docs/installations/windows
The tests I have made based on this branch are using the MSYS2-based setup of GTK, which works fine.
- Install MSYS2: https://msys2.github.io/
- Update MSYS2:
pacman -Syuu - Install GTK 3/4 via the MSYS shell:
pacman -S mingw-w64-x86_64-gtk3 pacman -S mingw-w64-x86_64-gtk4 - Add the libraries installed via MSYS to your
PATH. E.g., when using the default MSYS installation directoryC:\msys64, thePATHentry should be:C:\msys64\mingw64\bin - Optional: If you want to or need to compile the SWT binaries, you should istall:
pacman -S mingw-w64-x86_64-toolchain
For GTK on Windows, there is a new SWT fragment project in the binaries folder: org.eclipse.swt.gtk.win32.x86_64. Be aware that it is currently integrated via some tweaks, e.g., the misuse of the specified window system to ensure that GTK fragment is used on Windows even though a Win32 window system is present and to not use the original Windows fragment.
Steps to use:
- Have an ordinary Eclipse SDK workspace with SWT.
- Checkout this branch and, if necessary, rebase it onto your used SWT state.
- Import the
org.eclipse.swt.gtk.win32.x86_64fragment into your Eclipse workspace. - In case you do not use the state of SWT as provided in the
gtk-on-windowsbranch, you need to generate the binaries (see below). - Start some product (for example the
org.eclipse.sdk.ideproduct) using SWT and make sure that your launch configuration uses the GTK instead of the Win32 SWT fragment and that the Win32-specific UI fragments are not enabled.- The following should not be enabled:
org.eclipse.swt.win32.win32.x86_64org.eclipse.compare.win32org.eclipse.e4.ui.swt.win32org.eclipse.ui.win32
- The following should be enabled instead:
org.eclipse.swt.gtk.win32.x86_64
- The following should not be enabled:
-
Start a Maven build for the SWT repository by calling
mvn clean compilein the root folder. This will currently not succeeds but will at least generate some metadata for the binaries generation. -
Run the following command in the
binares/org.eclipse.swt.gtk.win32.x86_64folder:mvn clean process-resources -Dnative=gtk.win32.x86_64 -Dws=gtk -Dos=win32 -Darch=x86_64 -DskipTestsThis should generate the binaries, i.e, in the
build-native-binariesphase, it should execute the batch script running the C++ compiler and the copy the generated *.dll files to the project folder.
Note that this currently only builds GTK3 binaries and does not allow to use GTK4 yet. However, it's only because the latter has not been tried out and might be easy to achieve.
Some limitations of the GTK on Windows usage for SWT have been documented in the original issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=488431
There are two further tweaks currently applied in this branch:
- Images used by TreeItems are not accessed properly. They are stored in an image map of the item's Tree, but not retrieved properly. In this branch, a patch is applied that simply stored the proper image surface within each TreeItem.
- A specific shell constructor is currently not working, making the splash screen creation fail. In this branch, a patch is applied that simply creates a new shell for the splash instead of used a passed handle.
When using SWT with the Eclipse Platform, note that the Win32-specific bundles can currently not be used and have to be removed from launch configurations:
org.eclipse.compare.win32org.eclipse.e4.ui.swt.win32org.eclipse.ui.win32
They may need to or can be replaced by GTK-specific bundles, but no work has been done on that yet.
From donor commits 420209f74c3 ("Port for illumos-based distros") and 982b4c3b8e5, line carried verbatim. The port's files: fragment binaries/org.eclipse.swt.gtk.solaris.x86_64 (outside the default binaries/pom.xml reactor, like gtk.linux.loongarch64, until illumos natives are built), binaries/legal_files/gtk.solaris, and the SunOS case of Eclipse SWT PI/gtk/library/build.sh with make_solaris_x86_64.mak.
Port for illumos-based distros (tested on OpenIndiana).
Appended by the additive superset resolution (DOC recipe: keep ours, append the donor section). Source: README.md of
claesrosell/prototype-skija at f262d18f088f (2025-02-22), the
Initiative 31 prototype-skija history before its 2025 rebase, carried in this repository's history as a merge parent.
The text describes that donor branch, not this tree: here the native widgets stay on the M3 viewport, the Initiative 31
look is a renderer and look-and-feel option (ALL_WIDGETS_VIEWPORT_PLAN.md,
LOOK_AND_FEEL.md), and the SkijaGC operation mapping was adapted for the M3 GPU planes.
This repository is a fork of the original SWT repository containing prototyping work on exchanging the adaptation of native, basic widgets with custom-drawn widgets based on the rendering engine Skia and its Java bindings Skija.
In the following, you find information about the current state of the prototype and how to try it out. Note that the prototype does currently not provide other/better look and feel or customizability compared to the native widgets. It is supposed to demonstrate feasibility to custom draw widgets based on an efficient rendering engine (as an enabler for improved customizability and look and feel) while seamlessly integrating the custom-drawn widgets with the other, still native widgets. For that reason, the custom-drawn widgets are currently implemented to look similar to the existing widgets they replace, but they could be easily replaced with whatever look and feel is desired.
See our contributing information to find out how to contribute.
To test the prototype, an Eclipse IDE has to be set up and the SWT projects from this repository have to be imported into it to start example applications.
Note that the current development does not target all platforms (Windows, MacOS, Linux). Development usually happens on Windows (and partly MacOS), so the experience will be best there. No implementation and testing for Linux has been performed so far.
The prototype is currently based on the Eclipse release 2024-12.
- Set up a Eclipse IDE for Committers 2024-12, e.g.:
- Eclipse IDE for Committers 2024-12
- Eclipse SDK Development Environment using product version "4.34 - 2024-12" in the installer
- Clone this repository
- Start the downloaded IDE and import the following projects:
- The SWT bundle
org.eclipse.swt - The OS-specific fragment
org.eclipse.swt.$WS.$OS.$ARCHwith the placeholders according to your environment, such asorg.eclipse.swt.win32.win32.x86_64for the Windows fragment - Optional: For testing purposes
org.eclipse.swt.examples
- The SWT bundle
The resulting workspace should look something like this:

Starting with this, you can try out the SWT implementation with whatever application you want by also importing the according plug-ins into your workspace. Two reasonable, simple starting points are (1) the SWT ControlExample, a demo application containing all basic SWT widgets with configurability for most of their functionality, to see how the widgets look like and behave, and (2) a simple Eclipse application to see how it looks in a complete application.
The ControlExample is part of the example project. It is placed in org.eclipse.swt.examples.controlexample. You can run this class as a Java application. The application has tabs for the individual widgets. The tab that opens first is for the Button, which is completely custom-drawn. So almost everything you see on that page is custom-drawn via code of the prototype.
At the bottom of the application, a toggle button allows to switch between using the native and the Skija-based renderer ( GC) at runtime (see State). You can currently distinguish the two rendering engines by looking at the edges of buttons, which are currently not rounded when using the Skija-based GC. The following screenshot shows the rendering of that page based on Skija.
To start a simple Eclipse application, create a Run Configuration via the menu Run, menu item Run Configuration and in the dialog opening up by double-clicking on the Eclipse Application type to create a new configuration that you can launch via the Run button:

The Eclipse application that starts will automatically use the custom-drawn widgets. To see a page with mostly custom-drawn widgets, you can, for example, open the Create Java Project wizard:

Note that this is work-in-progress prototyping work. The implementation is not (supposed to be) production ready. Currently, there are (at least partial) custom implementations for the following basic widgets:
- Button
- Label
- Text
- Combo
For rendering, the custom-drawn widgets only rely on the functionalities of the GC, such a drawing text and primitives like lines.
In addition to using the existing, native GC, i.e., the rendering engine of the operating system, the implementation also contains a SkijaGC, providing (parts of) the same functionality but using Ski(j)a for rendering instead. To make these interchangeable, the common functionality has been extracted into an IGraphicsCanvas interface.




