swt

What are the main things that an experienced Java SWT programmer should be aware of when moving to Swing?

邮差的信 提交于 2019-12-01 09:31:39
What are the major differences which may be encountered? Any major differences in application design? Threading models? The way you go about constructing GUIs? Any features of SWT which aren't available in Swing? Few findings from my experience between Swing and SWT Rendering of Swing is a bit slower (my experience) and use much more memory Native look is possible just partially (depends on selected look'n'feel) Most of Swing components somehow implements MVC pattern (so you don't have to make your own data binding) It's possible to subclass components and it is used when you have to change

SWT Global KeyListener Button Focus Problem

十年热恋 提交于 2019-12-01 09:18:29
for my app I need the space key to call a function independent from the focused widget, everywhere in the app but only if the according tab is opend. I found that one can add a filter to the display, like this: getShell().getDisplay().addFilter(SWT.KeyDown, new Listener() { public void handleEvent(Event arg0) { if( arg0.character == 32 ) { /**SPACE*/ if( mainTabs.getSelection().equals(analyseSoundFilesTab)) { soundController.playButtonClickHandler(); } } } }); That works fine most of the time, but if I give a button the focus via the "tab" or "shift tab", its kinda strange - the space bar will

Adding item to Eclipse text viewer context menu

冷暖自知 提交于 2019-12-01 08:58:33
I am developing a plugin for eclipse. In this plugin I need to be able to add an item to the context menu in the text editor. So far I have been unsuccessful in this, does anyone know how to add this item. Also, how do I get a string with the text currently selected in the editor. Thank you so much. VonC Regarding the selection part, the question " Replace selected code from eclipse editor thru plugin comand " is quite adequate for your need: try { IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if ( part instanceof ITextEditor ) {

SWT ExpandListener executes before collapse occurs on Linux

牧云@^-^@ 提交于 2019-12-01 08:42:23
问题 This is a simple executable snippet that shows the issue. When using the ExpandBar the desired outcome is to resize the window when there is a collapse or expand. It works properly on Mac but does not on Linux. It looks like the ExpandListener is called before the collapse/expand actually occurs and therefore the pack() resizes incorrectly. The async execution is merely a bandage to have it work on Mac but this does not work on Linux. import org.eclipse.swt.*; import org.eclipse.swt.layout.*;

draw outline border on Text component

[亡魂溺海] 提交于 2019-12-01 08:38:30
I'm trying to draw a border over a Text in SWT... This is what I got for now: public class BorderedText extends Text { public BorderedText(Composite parent, int style) { super(parent, style); addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setAntialias(SWT.ON); if (isFocusControl()) { Color color = new Color(getDisplay(), new RGB(82, 168, 236)); e.gc.setAlpha(200); e.gc.setForeground(color); Rectangle rect = new Rectangle(0,0, getClientArea().width-1, getClientArea().height-1); Transform t = new Transform(getDisplay()); e.gc.setTransform(t); e.gc

swt table has limitation on text length in a cell?

China☆狼群 提交于 2019-12-01 08:35:30
问题 I use JFace TableViewer and databinding to display data of a database table, some columns have very long text, I found the text is cut out. if I activate the text editor associated with that cell, I can see the full text. Does swt table has limitation on text length in a cell ? or the OS has such limitation ?(I am using eclipse 3.6 and windows 7 32 bit) /******************************************************************************* * Copyright (c) 2006 Tom Schindl and others. * All rights

Sleak (SWT & RCP) : Device is not tracking resource allocation (eclipse 4.3)

六眼飞鱼酱① 提交于 2019-12-01 07:12:01
问题 my RCP application (Video-Player with OpenCV java) throws the famous: org.eclipse.swt.SWTError: No more handles Error So now I found Sleak and a tutorial I tryed the first way, but when I start the app and click on the snap button in the Sleak-View I got: "WARNING: Device is not tracking resource allocation". When I do it the second way(.options file and -debug in the eclipse.ini (inserted befor the -vmargs) I get some results in the sleak view but they are all Eclipse Resources... like said

SWT Table Sorting by clicking the column header

我怕爱的太早我们不能终老 提交于 2019-12-01 06:50:48
问题 In swt table- sorting works for Strings how to do sorting for Integer, Double and Date values. And this only works for String ascending. Can anyone suggest a better way to do it. TableItem item = new TableItem(table, SWT.NONE); item.setText(new String[] { "1", "v", "1.1", "20/03/2013" }); item = new TableItem(table, SWT.NONE); item.setText(new String[] { "10", "z", "1.5", "20/04/2013" }); item = new TableItem(table, SWT.NONE); item.setText(new String[] { "3", "a", "1.3", "30/01/2013" });

Adding item to Eclipse text viewer context menu

我只是一个虾纸丫 提交于 2019-12-01 06:36:24
问题 I am developing a plugin for eclipse. In this plugin I need to be able to add an item to the context menu in the text editor. So far I have been unsuccessful in this, does anyone know how to add this item. Also, how do I get a string with the text currently selected in the editor. Thank you so much. 回答1: Regarding the selection part, the question "Replace selected code from eclipse editor thru plugin comand" is quite adequate for your need: try { IEditorPart part = PlatformUI.getWorkbench()

Using the 64bit XulRunner in Eclipse SWT under Windows

一曲冷凌霜 提交于 2019-12-01 06:16:49
Is it possible to use the 64bit XulRunner for Windows ( available from here ) with the Eclipse browser widget? It works fine under 32bit Windows and the answer to this question explains how this works. But when I try this under 64bit Windows I get the following exception: org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-xulrunner-win32-3834 in java.library.path no swt-xulrunner-win32 in java.library.path Can't load library: C:\Users\...\.swt\lib\win32\x86_64\swt-xulrunner-win32- 3834.dll Can't load library: C:\Users\...\.swt