swt

Swt table getData() to string list

南楼画角 提交于 2019-12-08 13:43:22
问题 I have populated swt Table and it displays it OK, but now I want to get data from swt Table to Is there any solution to get data to array or list from table? 回答1: Try TableItem[] tableItems = table.getItems(); to get the the value of the first row at the 2nd column tableItems[0].getText(1) You might want to look into JFace TableViewer to make this easier. 来源: https://stackoverflow.com/questions/6973826/swt-table-getdata-to-string-list

How can we add Menu to Label in swt

不想你离开。 提交于 2019-12-08 12:02:44
问题 How can I add Menu to label? I want to show a drop down menu by clicking on label to show some options to user. How is it possible in SWT? 回答1: You can add a Menu to all Control s by calling Control#setMenu(Menu) . Here is a small example for a Label : public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); Label label = new Label(shell, SWT.NONE); label.setText("Right-click

Dispose of SWT shell when cursor moves out of it

南笙酒味 提交于 2019-12-08 11:35:01
问题 I'm implementing a custom preview/tooltip for an Eclipse plug-in. It did it using a Shell in SWT, removing all its trimmings and placing a text box inside it. It looks great. However now I need to dispose of the shell when the cursor moves out of the shell window and I ran into some issues: Does it make sense to attach a mousemoveListener to the shell? First I was doing this but then I realized that this listener only captures mouse move Events which occur inside the shell. How will I capture

How can I open pdf files in SWT browser window while using XULRunner?

拜拜、爱过 提交于 2019-12-08 09:16:40
问题 I am working on an eclipse based application wherein I need to preview pdf documents as part of a functionality. As of now clicking on preview button opens a prompt for saving the pdf but it does not directly open the document in the required window. Is there any way where I can add any arguments/Plugins in the XULRunner or the application's ini file so that the pdf can be opened in the window itself by default ? (I am using Red Hat Linux 6.5 (Santiago)) 回答1: The following applies to Linux

Import SWT as a Gradle dependency

被刻印的时光 ゝ 提交于 2019-12-08 08:59:34
问题 I am looking at how to import the SWT UI library into my Java project. I found the pom file for SWT on maven at: https://repo1.maven.org/maven2/org/eclipse/swt/3.3.0-v3346/swt-3.3.0-v3346.pom From the file I added the following line to my build.gradle file compile "org.eclipse:swt:3.3.0" however when I added it to my build.gradle I received the following error: Project 'L-CAD Main' is missing required library: '/home/ashley/unresolved dependency - org.eclipse swt 3.3.0' If I understand this

Java/SWT: How to receive mouse events from an embedded window

社会主义新天地 提交于 2019-12-08 08:52:28
问题 I am embedding a windows application into my SWT application using 'reparenting'. That part works ok. I would now like to hook my SWT app into the message queue for the embedded app to receive mouse move events. I see that the OS class in SWT has a number of interesting methods for adding hooks but I have not been able to figure out how to use them. Can anyone help? Thanks 回答1: This should work, but it relies on using reflection to call non-API, so use it at your own risk. Use reflection to

SWT Drag to Explorer (Windows) or Finder (OS X)

≯℡__Kan透↙ 提交于 2019-12-08 08:30:23
问题 I've got an SWT application with a bunch of graphical elements. I'd like for the user to be able to drag an element to their Desktop / Windows Explorer / OS X Finder. When they drop the element, I need the path that they dropped it to, so that I can create a file in that location which represents the element. I don't think I can use a FileTransfer , because there is no source file. There is a source object which can create a file, but only once it knows where to put it. Inlined below is a

SWT: prevent Tree from expanding by doubleclick?

冷暖自知 提交于 2019-12-08 08:24:31
问题 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. So my idea was: adding a Listener to the tree, which opens a new Dialog by DoubleClick, which shows the entries' details. So far so good. If I do a double click on a item, it works. BUT: If I do a double click on a parent Item, it will expand (and

Build multi-platform executable for a SWT application (Eclipse)

孤街醉人 提交于 2019-12-08 07:26:00
问题 I have an Eclipse-based SWT application, not using Maven. My application targets multiple operating systems (CentOS, Windows, and Mac). The only jar file that is not OS agnostic is the SWT library, which is specific to each OS type, not to mention processor type (x86 and/or x64). I saw this other issue, but that targets Maven and I am not using Maven. I have "org.eclipse.swt" added to my project by following an outlined procedure and including the entire SWT downloaded ZIP file. That

Eclipse plugin: make Combo to handle Enter key

我们两清 提交于 2019-12-08 06:24:33
问题 Eclipse plugin: how to make Combo to handle Enter key pressing? That is after entering some text user can press Enter, that will case some processing. The same processing can be started by Button "Run" click. org.eclipse.swt.widgets.Combo 回答1: Just add a Listener for SWT.KeyUp and check if the entered character is equal to SWT.CR . Here is some code: public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow")