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
0 answers

C# White UI Automation: can't find SWT window

I'm using White for UI automation and it was working fine until I met an app that was created in Java. In that case I'm unable to find any windows. If I get all Windows from the desktop then I can see the window's name I'm looking…
2
votes
2 answers

Drawing into an Eclipse editor

I am trying to draw some shapes (boxed ans arrows) into, i.e., "over" the text in an eclipse editor. To get started, I wrote the following code: IWorkbenchPage activePage =…
user66237
  • 793
  • 1
  • 5
  • 19
2
votes
1 answer

SWT Tree - Lowering the native expand icon possible?

I have a JFace TreeViewer with a SWT Tree underlaying and I am painting my cells for multiple row support for myself. Currently, it looks like this: I want both the expand icon and the label to be lowered like this: This is no problem for the…
Stefano L
  • 1,486
  • 2
  • 15
  • 36
2
votes
1 answer

Understanding the bitwise OR of SWT Constants

I'm examining some SWT code and I'm having trouble understanding how the SWT constants work and particularly, how their bitwose OR works. For example: final Table leftTable = new Table(parent, SWT.MULTI | SWT.FULL_SELECTION); I looked up SWT.MULTI…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
2
votes
3 answers

Turning on anti-aliasing in SWT

I've called gc.setAntialias(SWT.ON); and it does nothing. According to that method, it should work. The Javadoc states: Sets the receiver's anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON. It's not…
andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
2
votes
1 answer

Deselect all SWT radio buttons of a group

I have a couple of SWT ToolItems with style SWT.RADIO in a tool bar. I would like to deselect all of them programmatically using toolItem.setSelection(false), but it is not possible. The ToolItem currently selected remains selected. I can select…
user2426340
  • 23
  • 1
  • 5
2
votes
1 answer

How to get exactly Eclipse Editor kind of Tool Tip in RCP/SWT Table cell

I want to get Exactly eclipse editor kind highly customized tooltip like below- I used eclipse provided snippets of customized Tooltips but none of them were so highly improvised performance and easy to use. How to reuse these Tooltips , any…
Abhishek Choudhary
  • 8,255
  • 19
  • 69
  • 128
2
votes
1 answer

WindowTester - Accessing file system (tree) item in a rcp client

I am wondering weather it is possible to reach tree elements in a Java RCP-Client which display a file system by using googles windowtester pro. The tree (swt widget) shows my local file system (C:\Users...) much like the windows explorer (or…
2
votes
2 answers

Advanced SWT table widgets

There are a couple of "advanced" table/spreadsheet SWT widgets out there (Nattable, Nebula Grid), but none of them support really large datasets. Nattable is the one which comes closest, but it still has limitations in the datatypes it uses causing…
JesperE
  • 63,317
  • 21
  • 138
  • 197
2
votes
3 answers

Layouting the parent of a parent of a parent

We have a tool, that has a GUI which contains multiple Sections. In these sections, we have Expandable Composites which are not expanded by default. When we try to expand these composites, the + becomes a -, but it stays closed: To fix this, I…
looper
  • 1,929
  • 23
  • 42
2
votes
1 answer

Is there a framework available to collect user feedback on an SWT GUI?

After 2 years of development, our Eclipse RCP desktop application is finally finished. The last step in development is to allow the client to provide feedback on the wording and labels in the application. There will be about 10 people providing…
parasietje
  • 1,529
  • 8
  • 36
2
votes
1 answer

Listener to tell if a table has an element in it

I'm working on a Java project using SWT/JFace. I have a Table that is using a TableViewer. The table will only ever have 0 or 1 items in it (depending on the data it's viewing...). Is there a way to listen to this table to see if it has an item in…
crhurley4
  • 21
  • 1
2
votes
1 answer

Retrieve widget from TableItem

I built a Table (org.eclipse.swt.widgets.Table) and used a TableEditor to add 2 checkboxes on each TableItem (row). TableItem tableItem = new TableItem(tableClientes, SWT.NONE); TableEditor editor = new TableEditor(tableClientes); Button…
BBacon
  • 2,456
  • 5
  • 32
  • 52
2
votes
1 answer

Documentation and Tutorials for XWT

I'm currently in the design phase of a Java based project. The frontend is not overly complicated (consists of 4 to 5 separate composites/windows), meaning, it is certainly doable using plain SWT. However, if possible, I'd like to further separate…
dsd
  • 551
  • 5
  • 17
2
votes
2 answers

Not able to implement drag and drop; dragSetData not getting called

I am trying to incorporate a drag-and-drop feature with our product. I have created a new custom view which has a tree structure and am interested in dropping the content from this tree to an already existing tree structure within the application…
Pavan Dittakavi
  • 3,013
  • 5
  • 27
  • 47