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

Does Java SWT Widgets influence Thread perfomance?

I'm using StyledText 400x100 widget and it's working like a console where the program interacts with the user. This is how I update the widget: private static Shell MainShell = null; public void createPartControl(Composite parent){ MainShell =…
Zbarcea Christian
  • 9,367
  • 22
  • 84
  • 137
2
votes
1 answer

How to disable fullscreen button in Mac OS in SWT / Java App?

I am working on SWT app. It works fine on windows, but when I run the same code on mac. I get a full screen button on right corner of my shell. On clicking that full screen button the app stop responding and nothing happens. I want to disable the…
HDdeveloper
  • 4,396
  • 6
  • 40
  • 65
2
votes
2 answers

Date time picker control

I look for date time picker control which look like this: (source: functionx.com) All controls which I found don't use system layout. It would be great if this control use system style and layout.
Michał Ziober
  • 37,175
  • 18
  • 99
  • 146
2
votes
1 answer

Is there any way to truncate org.eclipse.swt.widgets.Table item's text

I'm using org.eclipse.swt.widgets.Table. I have a column whose width is 100, say if the corresponding TableItem's text is longer than the column width, I want the remaining text to appear in a new line in that cell. Is it possible?
user1168608
  • 598
  • 2
  • 10
  • 27
2
votes
1 answer

SWTError: Not implemented [multiple displays]

I am trying to open a SWT-file-browser in on button click event. tnAddFiles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new…
HDdeveloper
  • 4,396
  • 6
  • 40
  • 65
2
votes
1 answer

What is the state of SWT to WPF port?

A while ago I read about a WPF port of Eclipse and SWT. I can't find any recent information about it. What is the current status of the WPF port? Will it be available before E4? Any other details about the implementation also welcome.
Tomas Andrle
  • 13,132
  • 15
  • 75
  • 92
2
votes
1 answer

Modal dialogs stay on the back of other windows on Opensuse

In my application, there are dialog screens written by java SWT. When a modal dialog (warning/error/file dialog etc.) is opened, it can not stay on top of the parent screen after clicking the parent screen, or it is opened behind of the main screen.…
user1766006
  • 177
  • 1
  • 14
2
votes
2 answers

SWT Table with SWT.VIRTUAL raises StackOverflowError

After recently installing Windows 7 Professional, I'm getting a strange problem removing a TableItem from a populated Table in SWT. It is specific to Windows 7 and to the SWT.VIRTUAL style constant for the table. Consider the following code: table =…
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
2
votes
1 answer

Getting the text from composite in eclipse using the SWTbot API

I am trying to get the Text from a Composite in Eclipse using the SWTbot API. I have Composite which contains Main Group and That Main Group Contains Child Groups. The problem i am facing is i am not able to get the Text Inside the Composite, is…
user1344022
  • 193
  • 2
  • 3
  • 10
2
votes
0 answers

How enable and disable buttons using DataBinding in SWT

I'm using data binding for synchronizing b/w two button. If one is enable then other should be disable or vise-versa. In my code at starting time it works fine but when I'm changing button2 to disable other is not changing to enable. Question: What…
Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
2
votes
1 answer

Java/SWT displaying an 8bit grayscaling Image from a byte array

I'm building a GUI with the Eclipse Window Builder Editor. I've made a Composite with a Gridlayout and have put a Label in there. Some method from another class generates a raw 8 bit 1280x1024 grayscale image which is saved in a byte array. This is…
2
votes
0 answers

Windows: Can a GDI handle outlive the process which created it?

I am trying to track down the cause of a Windows-only problem in my SWT application, which sometimes runs into the following error: org.eclipse.swt.SWTError: No more handles Tracing the line which throws this error reveals that it's calling the…
David North
  • 1,247
  • 1
  • 14
  • 32
2
votes
1 answer

How to right-align text in a SWT Table cell on a per-cell basis

I have a SWT table wrapped by a JFace TableViewer. I know how to right-align an entire column: TableColumn column = new TableColumn(viewer.getTable(), SWT.RIGHT); However, what I want to do is vary the alignment on a per-cell basis according to the…
Emily M
  • 161
  • 1
  • 8
2
votes
1 answer

JFace resizing only the last group in a TitleAreaDialog

the program attached below creates a TitleAreaDialog with four groups in them. Each of the groups contain controls and the last one is "dynamic", i.e. when selecting an entry in the combo box, a certain number of controls is generated. Now,…
2
votes
0 answers

Unable to start Android SDK Manager due to SWT invalid starting thread

When starting the Android SDK Manager, either via eclipse or via ./android, I get the following error: hamiltont$ android ***WARNING: Display must be created on main thread due to Cocoa restrictions. org.eclipse.swt.SWTException: Invalid thread…
Hamy
  • 20,662
  • 15
  • 74
  • 102
1 2 3
99
100