swt

SWT MouseDown event too dominant for custom selecting controls

 ̄綄美尐妖づ 提交于 2019-12-12 04:58:35
问题 I have made the UI/Editor you can see in the picture below. The Text is displayed by StyledText s. The black lines are custom borders that are in fact Label s with lines drawn on them. Now my goal is to provide a selection that allows the user to select the Control s to delete them or add others to them. The second image shows a example selection. So started with all kinds of MouseEvent s this is more complicated than I initially thought. When the MouseDown event is fired on any Control I am

Unable to make ant script with swtjar

◇◆丶佛笑我妖孽 提交于 2019-12-12 04:54:32
问题 I am attempting to make a cross platform .jar of a program that uses SWT for its GUI. I stumbled upon this and this, and have tried to use it in my own program. I am not very experienced with ant scripts, and this program has a lot of other .jars in its build path, so I used eclipse to generate an ant build script, which I modified to include the swtjar task. However, when the script runs and gets to the swtjar task, it fails and says that The archive swtjar.jar doesn't exist . I also tried

How to search for required elements in list using jface

浪尽此生 提交于 2019-12-12 04:54:04
问题 I have created a list using swt which displays a list of animals ex:cat,dog,camel,elephant. and now i need to search for a specific animal ex dog in search coloumn and only that animal has to be displayed in the list .So how can this be done using jface.I am new to jface,Please help me to search the list. 回答1: All JFace Viewer s support ViewerFilter s. Here is a good tutorial about them. Here's a very basic example that should show you how you can use ViewerFilter s: public static void main

How to expand an object in a Treeviewer?

笑着哭i 提交于 2019-12-12 04:47:01
问题 I am trying to understand java treeviews. I created a Treeviewer with the following tutorial: http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm Now I have a problem that I can´t solve :/ I want to expand the book-objects with another object. For example: + BookTitleX BookAuthorX etc otherobjectname etc etc etc How can I add an object to an object ? Thank u so much This is the code: Content Provider: import java.util.Iterator; import org.eclipse.jface.viewers

jar-in-jar class loading issue

試著忘記壹切 提交于 2019-12-12 04:28:25
问题 i followed the steps described at Create cross platform Java SWT Application . i create a jar which has a swt_browser.jar containing only my class using swt library. then i added other platrom-specific swt jars. i use the below code to load the swt_browser.jar and the platform specific swt library jar. but somehow the call for loading class SWTBrowser complains : java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Layout can you tell what i am doing wrong? -----code for loading swt jars

SWT drop cursor position on canvas

我只是一个虾纸丫 提交于 2019-12-12 04:17:57
问题 I'm making a simple "paint" application in JAVA. I would have wanted that when the person clicks the canvas, and make a drag and drop, a listener get the drop cursor location, but I don't find how make a drop listener. How can I find the location of the cursor when the user stop his click? I have the following code for the drag : Canvas paintC = new Canvas(shell, SWT.NONE); paintC.addDragDetectListener(new DragDetectListener() { public void dragDetected(DragDetectEvent arg0) { Point

is it possible to have vertical SWT controls?

故事扮演 提交于 2019-12-12 04:00:31
问题 I would like to have some of the controls in an app - Button s and Label s - vertically oriented - . However i could not find a possibilty to do this. Even the non-public setOrientation method tackles only the left-to-right orientation. Is it possible without implementing a custom Button or deriving from Canvas ? 回答1: As far as I know vertical orientation for Button and Label is not possible. You will need to provide custom implementation for same. Check this link http://dev.eclipse.org

JavaFX WebView Context Menu

六月ゝ 毕业季﹏ 提交于 2019-12-12 03:48:05
问题 I am trying to implement a simple browser using the JavaFX WebView/WebEngine inside of an SWT application using the FXCanvas. For some reason, the inbuilt context menu (with things like Refresh Copy/Paste etc.) does not seem to be working. If I create my own JavaFX context menu then it works, but I can't find a way to determine what HTML element is under the mouse at a given point (i.e. to have different menu items for links vs. images) A simple example that shows this behavior: import org

How to change the foreground color of specific items in a List?

孤人 提交于 2019-12-12 03:29:44
问题 When I press a button, I want to change the foreground color of the selected item in a List . So far, I tried this: list.setForeground(display.getSystemColor(SWT.COLOR_RED)); but it changes the foreground color of all the items, not just the selected one. Any ideas how to solve this? 回答1: Doing this with a List would require custom drawing. You are better off using a Table instead (or even a TableViewer depending on your requirements). Here is an example of a table that does what you want:

Relative filepath to access resources

末鹿安然 提交于 2019-12-12 03:24:37
问题 I am quite new to Eclipse 4, RCP and SWT and I am stuck on this issue : I want to access image resources from code with a relative filepath. Problem is that the default location ./ is set to my home directory /home/name/ (I'm using Ubuntu). I have found that by creating a new File and printing its CanonicalPath. I am used to having the default location set to the project directory, such as /home/name/workspace/project/ , which is, from what I've seen so far, the default behavior in Eclipse /