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
2
votes
1 answer

Disable spell check in SWT Browser widget

I'm working on an Eclipse based application in which we use a Browser widget. When typing text in this widget, a spell check is executed. We would like to deactivate it. Is it possible ?
Anthony Richir
  • 649
  • 2
  • 8
  • 31
2
votes
0 answers

Eclipse Docking Windows implementation: does Eclipse reimplement Docking Windows on top of Graphic Context instead of using native ones?

I'm trying to implement docking windows in my application on GTK+ and decided to mimic to their implementation in SWT over GTK+. I'm interested in moving docking subwindows and creating and moving tabs between notebooks/TabFolders within dock…
Boris Burkov
  • 13,420
  • 17
  • 74
  • 109
2
votes
1 answer

Get SWT element's parent Part

I need to reference the Part object that created an SWT element. The Part is creating a Label in Part's @PostConstruct like that (e4): public class SomePart { @PostConstruct public void postConstruct(Composite parent) { ... …
Oroboros102
  • 2,214
  • 1
  • 27
  • 41
2
votes
1 answer

SWT Browser widget with Eclipse 4 RCP application

Please help to get started with Eclipse 4 RCP. Set task is to create simple application with imbedded browser (using SWT Browser widget) This Lars Vogel's Eclipse 4 RCP tutorial is used. Created application is on GitHub. Now I want to add SWT…
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
2
votes
1 answer

Can I hide the file extensions in an SWT FileDialog filter?

I have an SWT FileDialog (style: SWT.OPEN) with multiple filters each with multiple file extensions. I want to include an "All known formats" filter with every file extension the application recognizes. This list is very long and will not fit…
Steven Darnell
  • 339
  • 1
  • 11
2
votes
1 answer

"Navigation Bar" SWT control

Does already someone has written an SWT control like the "Navigation Bar" in IDEA? For those who don't know what I mean: it looks like path1 > path2 > path3 > where each "path" is a part of a full path simulating a button which can be clicked and…
Mot
  • 28,248
  • 23
  • 84
  • 121
2
votes
1 answer

Obtaining the Eclipse text font

How do I get a Font object representing the font set as the "Text Font" in the Eclipse Preferences -> General -> Appearance -> Colors and Fonts? I'm implementing a table-view where one of the columns is supposed to contained fixed-width text.
JesperE
  • 63,317
  • 21
  • 138
  • 197
2
votes
1 answer

Set tooltip text for each element in an SWT Combo widget

I've been looking around for ages and can't seem to find whether this is possible or not. I have a Combo widget populated with some strings and wan't to set the tool tip text to be something different for each item in the Combo widget. i.e. When you…
SteWoo
  • 458
  • 1
  • 8
  • 21
2
votes
1 answer

Selection and MenuDetection Creating Pop-Up Menu from TrayIcon Differently (OSX)

I am developing an OSX application using SWT and I have a TrayIcon in the system tray. I got it to work, but there is this one little thing that really bugs me. When you right click the icon, the context menu is displayed just how I…
Liam
  • 21
  • 2
2
votes
1 answer

How to create controls dynamically in JFace Wizard

I have a jFace wizard, I am using this to create a new project type eclipse plugin. As you can see from image below, I have one treeviewer on left side, and a SWT group on right side. What I want is when ever user selects one of the item from…
Pradeep Simha
  • 17,683
  • 18
  • 56
  • 107
2
votes
1 answer

How to dynamically create SWT buttons and their actions?

I have one OK button(push button) created. Based on user input i want to dynamically create 1 to 10 SWT buttons(check box). How to create it? If OK button is clicked, how to display which are all check box button has been selected? Please find below…
yash
  • 101
  • 2
  • 9
2
votes
1 answer

Print using SWT Browser Widget

I want to print the contents of a SWT Browser Widget. but it prints the only the visible part of the browser not the full content of it. Please help.
Sumant
  • 496
  • 1
  • 6
  • 20
2
votes
1 answer

SWT: How to right align items in a toolbar

In a pure SWT/JFace application, I need to align toolbar items to the right. I first tried to use the SWT.RIGHT style when creating the Toolbar but items are still left aligned. After some investigations, I found out that SWT.RIGHT is used for the…
ozeebee
  • 1,878
  • 2
  • 23
  • 26
2
votes
3 answers

SWT: prevent Tree from expanding by doubleclick?

I have a problem with SWT Tree. My situation is like this: I have a SWT Tree, which contains many TreeItems (Log entries), which contain TreeItems too. Those log entries have really long messages, which could not be shown in the TreeColumns at all.…
2
votes
2 answers

Threaded drawing onto a canvas in Java SWT

I've been working quite a bit on something I can only describe as a "threaded canvas" for some time now. In a moment I'll describe what I have, but since I'm really open to new ideas, existing solutions or a completely fresh start, I'll formulate…
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
1 2 3
99
100