swt

draw outline border on Text component

狂风中的少年 提交于 2019-12-19 09:56:13
问题 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()

Display.getCurrent().asyncExec not run in parallel?

回眸只為那壹抹淺笑 提交于 2019-12-19 08:20:07
问题 Here is my code: Display.getCurrent().asyncExec(new Runnable() { public void run() { try { Event e1 = new Event(); e1.type = EVT_CONNECTING; for (Listener listener : listeners) { listener.handleEvent(e1); } database = new Database(cp.getName(), cp.getConnection()); Event e2 = new Event(); e2.type = EVT_CONNECT_SUCCESS; for (Listener listener : listeners) { listener.handleEvent(e2); } } catch (Exception ex) { log.error(ex.getMessage(), ex); Event e = new Event(); e.text = ex.getMessage(); e

How to Add Text and Image Both in a SWT LABEL

a 夏天 提交于 2019-12-19 06:46:26
问题 Is there any way to add Text and Image in SWT label in a single line. Once I add image, text goes off. 回答1: No you can't have an image and text simultaneously in a Label (unless you custom draw it). Else use org.eclipse.swt.custom.CLabel : Code: import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class LabelTest {

Non-Modal JFace Dialog?

一曲冷凌霜 提交于 2019-12-19 05:30:15
问题 Simply put: Is there any way to create non-modal JFace dialog? I've tried calling setShellStyle to no avail. If I remember right this isn't a problem in swing - is this a shortcoming of SWT, or am I just misusing the widget? TIA 回答1: Using setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); setBlockOnOpen(false); seems to be the practice. This doesn't work for you? 回答2: @Override protected void setShellStyle(int newShellStyle) { super.setShellStyle(SWT.CLOSE | SWT.MODELESS| SWT

SWT-like GUI toolkit for C or C++

让人想犯罪 __ 提交于 2019-12-19 04:05:02
问题 Do you know any cross-platform GUI toolkit like swt for C (using default widgets in each operating system = right pics on eclipse.org/swt) ? There is an implementation of swt for D language called DWT but I need it for C or C++. Thanks. 回答1: Qt (community) wxWidgets FLTK GTK+ FOX Notus VCF - EDIT2 seems to be inactive for a few years You can read some details in that wiki. First 4 are pretty popular, the rest I dont know. EDIT: 8. There is C++ port but it seem Windows only for now 9. SWT/Fox

Eclipse RCP - ILazyTreeContentProvider implementation is unexpectedly eager

前提是你 提交于 2019-12-18 16:52:40
问题 I am developing an Eclipse RCP application, and am trying to use a ILazyTreeContentProvider implementation in order to show only the visible items at a certain time. The code: Inside the class extending ViewPart: public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new

How to display system icon for a file in SWT?

孤人 提交于 2019-12-18 15:27:11
问题 I want to display a file tree similarly to java2s.com 'Create a lazy file tree', but include the actual system icons - especially for folders. SWT does not seem to offer this (Program API does not support folders), so I came up with the following: public Image getImage(File file) { ImageIcon systemIcon = (ImageIcon) FileSystemView.getFileSystemView().getSystemIcon(file); java.awt.Image image = systemIcon.getImage(); int width = image.getWidth(null); int height = image.getHeight(null);

Scrolling SWT Table programmatically

牧云@^-^@ 提交于 2019-12-18 13:01:33
问题 How to do vertical scroll of SWT table programatically? I'm implementing search function on the table. When an item was found then it will be scrolled to the item found. 回答1: There are several methods you might want to try: Table.showItem(TableItem) Table.showSelection() Table.showColumn(TableColumn) Table.setTopIndex(int) Other than that, I suggest using a TableViewer from JFace. Then you'd scroll to an item with this method: TableViewer.reveal(Object) 回答2: My full time job is to develop SWT

Delete rows from Nattable

偶尔善良 提交于 2019-12-18 09:23:25
问题 I want to implement a row deletion logic in a Nebula Nattable. This is what I plan to do: Add context menu to the Nattable which is described in http://blog.vogella.com/2015/02/03/nattable-context-menus-with-eclipse-menus/ Add an SWT Action to the menu which will implement the delete my question is, which is the best way to accomplish this: Should I delete the corresponding value from my data model and the table view is refreshed when I execute this.natview.refresh(); ? OR Should I get the

Build multi-platform executable for a SWT application using maven

一个人想着一个人 提交于 2019-12-18 06:43:43
问题 My question is: How can I generate multiple executable Jar files (incl. dependencies) for a SWT application according to the target os/architecture at once using maven? I have created a SWT application, which have to run on different operating systems and architectures. The project is a Maven multi-module project including a parent POM. project-pom.xml (packaging = pom, specify SWT dependencies) `- application-module (inherit SWT dependencies) `- pom.xml (packaging = jar) `- domain-specific