Questions tagged [swt]

SWT: The Standard Widget Toolkit is a user interface library for Java maintained by the Eclipse Foundation. SWT uses native widgets wherever possible to provide a look and feel consistent with the host platform. SWT is a third-party library (not included in the JVM) and applications that rely on it must distribute the appropriate library for each target operating system. Use this tag for questions about developing SWT based applications.

SWT: The Standard Widget Toolkit

SWT example

SWT is a user interface library for Java maintained by the Eclipse Foundation. SWT uses native widgets wherever possible to provide a look and feel consistent with the host platform.

SWT is a third-party library (not included in the JVM) and applications that rely on it must distribute the appropriate library for each target operating system.

Hello World

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;

public class HelloSWT {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    Label label = new Label(shell, SWT.NONE);
    label.setText("Hello, World!");
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}

Reference Documentation

6100 questions
227
votes
9 answers

Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot?

There is quite a lot of gui frameworks out there for java, but what is recognized as today's framework of choice? The following is my understanding of the different frameworks, please correct me if im wrong. This is a very loosely defined set of…
netbrain
  • 9,194
  • 6
  • 42
  • 68
158
votes
10 answers

Java Desktop application: SWT vs. Swing

I'm a web developer at day and thinking about building my first real desktop application. The idea is to build a tool that automates a very repetitive task in a web application where no API is available. I know I want to use Java. I used it before…
janpio
  • 10,645
  • 16
  • 64
  • 107
75
votes
2 answers

How to make a JAR file that includes DLL files?

I bought a third-party Java library which includes a JAR file and two DLL files. I wrote my own Java program which invoke the third-party JAR file. Now my question is how can I package all my code into a single JAR file which include all my code and…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
65
votes
3 answers

Setting Colors in SWT

This is pretty simple, I come from a swing/awt background. I'm just wondering what the proper way to set the background color for a SWT widget is? I've been trying: widget.setBackground( ); Except I have no idea how to create the color Object in…
Brian Gianforcaro
  • 26,564
  • 11
  • 58
  • 77
53
votes
24 answers

Eclipse Bug: Unhandled event loop exception No more handles

I've built a GUI using Swing and the MigLayout. I am using Eclipse 4.2.2 (64-bit) on Windows 7 Ultimate. Every time I click back into the window to edit my code, a popup comes up, then I'm prompted to restart Eclipse, and the Event log says the…
HEADLESS_0NE
  • 3,416
  • 4
  • 32
  • 51
40
votes
18 answers

Packaging Java apps for the Windows/Linux desktop

I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive…
alexmcchessers
  • 954
  • 1
  • 13
  • 16
40
votes
6 answers

SWT on Windows 64-bit

My application throws the exception below. Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SW T libraries on 64-bit JVM. How to solve this? What is the name of jar file needed?
Palani
  • 1,891
  • 7
  • 31
  • 42
38
votes
6 answers

Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION?

When a Java VM crashes with an EXCEPTION_ACCESS_VIOLATION and produces an hs_err_pidXXX.log file, what does that indicate? The error itself is basically a null pointer exception. Is it always caused by a bug in the JVM, or are there other causes…
sk.
  • 6,336
  • 5
  • 38
  • 46
34
votes
5 answers

Create cross platform Java SWT Application

I have written a Java GUI using SWT. I package the application using an ANT script (fragment below).
mchr
  • 6,161
  • 6
  • 52
  • 74
32
votes
2 answers

Invalid Thread Access Error with Java SWT

I have a simple Java SWT app in Java so far but the weird thing is when I try to launch a messagebox/alert box upon listening to an event fired by one of my own classes, I get an error saying "Invalid thread access". My class event is fired and…
Carven
  • 14,988
  • 29
  • 118
  • 161
31
votes
9 answers

Rapid switch to Java for an experienced C++ developer

I'm am looking for online tutorials/books, which assume a solid knowledge of OOP/Design patterns concepts and stress on differences (both conceptional and syntactical) between C++ and Java thus allowing for a rapid development in the latter. Thank…
MadH
  • 1,498
  • 4
  • 21
  • 29
29
votes
5 answers

SWT - OS agnostic way to get monospaced font

Is there a way in SWT to get a monospaced font simply, that works across various operating systems? For example. this works on Linux, but not Windows: Font mono = new Font(parent.getDisplay(), "Mono", 10, SWT.NONE); or do I need to have a method…
JeeBee
  • 17,476
  • 5
  • 50
  • 60
27
votes
2 answers

Opening PDF file in SWT Browser - XulRunner default viewer

Situation: My RCP application uses XulRunner System has two installed PDF viewers (Acrobat, Gimp) Firefox has Gimp set as default viewer I want to make my SWT Browser composite in RCP application ignore default viewer and use Acrobat if it is…
Jan Hruby
  • 1,477
  • 1
  • 13
  • 26
27
votes
8 answers

SWT No More Handles

Windows XP has the limit 10000 user handles for each process and total 32000 for each desktop session. However, when I run 4 or 5 SWT process, each consuming no more than 2000 user handles, the SWT No More handles exception will always be…
James
  • 1,001
  • 2
  • 15
  • 23
26
votes
4 answers

Create GUI using Eclipse (Java)

Possible Duplicate: Best GUI designer for eclipse? Is there any Eclipse Plugin tool(s) who can help to create Graphical User Interface for (swing, awt or swt), because I'm tired of writing everytime the code of Panels, Labels, ... Thanks
Wassim AZIRAR
  • 10,823
  • 38
  • 121
  • 174
1
2 3
99 100