Tag Archives: SWT

SWT: Detecting which key was pressed during a MouseClick by Lars Vogel

Sometimes you want to detect the metakey which was pressed during a mouse click on SWT widget. This information is available in the SelectionEvent via the stateMask property. The following code shows an example for this.

Posted in Eclipse, Lars Vogel | Tagged , | Comments Off on SWT: Detecting which key was pressed during a MouseClick by Lars Vogel

Finding SWT resources leaks with Sleak

In SWT you must cleanup your allocated resources. Luckily the SWT Composite passed to you, is disposed by the framework so any Widget which you create on this control is disposed for you automatically. Except Fonts, Colors and Images. For … Continue reading

Posted in Eclipse | Tagged , | Comments Off on Finding SWT resources leaks with Sleak

WindowBuilder with Eclipse 4.2 / 3.8 (Linux)

Currently, if you trying to use WindowBuilder under Linux with Eclipse 3.8 / Eclipse 4.2, it renders incorrectly. Add the following line to the end of your eclipse.ini file to fix this: -Dorg.eclipse.swt.internal.gtk.useCairo=false This is a small bug in SWT … Continue reading

Posted in Eclipse | Tagged , , | Comments Off on WindowBuilder with Eclipse 4.2 / 3.8 (Linux)

Eclipse SWT – Creating an email in the default email client

As many of you properly know SWT has the nice Program.launch() method which allows to start programs associated with an URI. Example: Unfortunately this does not seem to be working on Linux. So if you are working under Linux you … Continue reading

Posted in Eclipse | Tagged , | 2 Comments

SWT Style Bits – Bitwise Or and Bitwise And

Ever wondered how SWT Style bits work? It is actually very simple. The style bits are a multitud of 2 SWT.NONE = 0, // 00000000 binary SWT.MULTI = 2, // 00000010 binary SWT.SINGLE = 4; // 00000100 binary SWT.READ_ONLY = … Continue reading

Posted in Eclipse | Tagged | 3 Comments

Browser Tales – Java to JavaScript and vice versa with the SWT Browser Widget

The SWT Browser widget makes it very easy to run HTML and JavaScript within Eclipse. This widget encapsulates a browser (system dependent) into a SWT widget. The following screenshot is from the second example below. This example is based on … Continue reading

Posted in Eclipse | Tagged , , | 1 Comment

JavaScript in the SWT Browser widget

At the Eclipse Summit Europe I listened to a talk of Boris Bokowski about Eclipse and the Web. Among other things I learned that you can execute JavaScript directly on the SWT Browser Widget and I wanted to give a … Continue reading

Posted in Eclipse | Tagged , | 4 Comments

SWT – Putting a file into the clipboard

I recently got the question how you can put a file into the system clipboard. SWT makes this trivial: Afer calling the method with a correct filename you should be able to paste the file, e.g. Strg+V into your system … Continue reading

Posted in Eclipse | Tagged | 5 Comments