GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eclipse-platform/eclipse.platform.swt: Eclipse SWT - The Standard Widget Toolkit

BranchesTags
Open more actions menu

Latest commit

 

History

32,347 Commits
32,347 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.mvn
.mvn
 
 
binaries
binaries
 
 
bundles
bundles
 
 
docs
docs
 
 
examples
examples
 
 
features/org.eclipse.swt.tools.feature
features/org.eclipse.swt.tools.feature
 
 
tests
tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Jenkinsfile
Jenkinsfile
 
 
LICENSE
LICENSE
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 
example.png
example.png
 
 
pom.xml
pom.xml
 
 
prepareNextDevCycle.sh
prepareNextDevCycle.sh
 
 

Repository files navigation

SWT Matrix Build Publish Unit Test Results License

About

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.

Getting Started

SWT comes with platform-specific jar files. Download them from https://download.eclipse.org/eclipse/downloads and add the jar file to your classpath.

Example

Example

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.

Contributing to SWT

Thanks for your interest in this project.

For information about contributing to Eclipse Platform in general, see the general CONTRIBUTING page.

Create Eclipse Development Environment for Eclipse SWT

Obtaining the sources

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:

  • https://github.com/git-lfs/git-lfs/wiki/Installation#installing

When using EGit from within Eclipse follow the EGit user guide on GIT LFS Support:

  • https://github.com/eclipse-egit/egit/wiki/User-Guide#git-lfs-support

Note:
Changes to the binary artifacts must not be committed, as the binaries are compiled only in the Eclipse infrastructure.

Building

To build all SWT artifacts and to run all tests, execute at the CLI from the repository root:

mvn clean verify

To build only the artifacts, without testing, run

mvn clean verify -DskipTests

For instructions on building the native binaries of SWT see the section Building native binaries.

Developer Resources

See the following description for how to contribute a feature or a bug fix to SWT.

  • https://eclipse.dev/eclipse/swt/

Information regarding source code management, builds, coding standards, and more can be found under the following link.

  • https://projects.eclipse.org/projects/eclipse.platform.swt/developer

Also see in the SWT section of the Eclipse FAQ for more background information about SWT.

  • https://github.com/eclipse-platform/eclipse.platform/blob/master/docs/FAQ/The_Official_Eclipse_FAQs.md#standard-widget-toolkit-swt

Contributor License Agreement

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).

  • https://www.eclipse.org/legal/eca/

Contact

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.

Evaluation of a Single, Cross-Platform SWT Implementation

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.

About

Eclipse SWT - The Standard Widget Toolkit

eclipse.dev/eclipse/swt/

Topics

cross-platform-guieclipseguijavaswtui

Resources

Readme
EPL-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

205 stars

Watchers

23 watching

Forks

211 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.