swt

How can we auto resize the size of components in SWT?

孤者浪人 提交于 2019-11-28 09:19:06
In my SWT application i have certain components inside the SWT shell. Now how can i auto re-size this components according to the size of display window. Display display = new Display(); Shell shell = new Shell(display); Group outerGroup,lowerGroup; Text text; public test1() { GridLayout gridLayout = new GridLayout(); gridLayout.numColumns=1; shell.setLayout(gridLayout); outerGroup = new Group(shell, SWT.NONE); GridData data = new GridData(1000,400); data.verticalSpan = 2; outerGroup.setLayoutData(data); gridLayout = new GridLayout(); gridLayout.numColumns=2; gridLayout.makeColumnsEqualWidth

How to set a Mask to a SWT Text to only allow Decimals

吃可爱长大的小学妹 提交于 2019-11-28 09:09:07
问题 What I want is that the user can only input decimal numbers on a Text, I don't want it to allow text input as: HELLO ABC.34 34.HEY 32.3333.123 I have been trying using VerifyListener, but it only gives me the portion of the text that got inserted, so I end up having the text that I want to insert and the text before the insertion, tried also combining the text, but I got problems when you delete a key (backspace) and I end up having a String like 234[BACKSPACE]455. Is there a way to set a

Java SWT and Invalid Thread Access

女生的网名这么多〃 提交于 2019-11-28 08:52:51
问题 I've seen this but it doesn't work for my code. This is my unique class: public static void main(String[] args) { try { Main window = new Main(); window.open(); } catch (Exception e) { e.printStackTrace(); } } public void open() { Display display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } protected void createContents() { shell = new Shell(SWT.CLOSE | SWT.MIN | SWT.TITLE | SWT

How can I creating executable JAR with SWT that runs on all platforms?

微笑、不失礼 提交于 2019-11-28 07:39:53
SWT comes with a base JAR and one specific JAR per platform (Windows, Linux/32bit, Linux/64bit, Mac, AIX, ...). How can I create an executable JAR that will select the correct platform JAR at runtime? [EDIT] I was thinking to supply all platform JARs in a subdirectory and in main() would then modify the class loader. Has anyone already tried this? Matías Look at this, there is a code sample: Create cross platform java swt application For my current job I needed to supply an executable jar that could load jars inside itself and execute a second main(). Basically a bootstrap main() and an

Exception in thread “main” org.eclipse.swt.SWTError: XPCOM error 0x80004005 in swt.mozilla

喜欢而已 提交于 2019-11-28 07:04:15
问题 following my SWT code which use Mozilla browser but it gives me an error xpcomm error 0x80004005. import java.awt.GridLayout; import java.io.File; import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets

How to detect ctrl-f in my SWT application

有些话、适合烂在心里 提交于 2019-11-28 07:01:58
I have written an SWT UI which has a primary function of displaying text in a StyledText control. I want to add a handler for Ctrl + F so that when that shortcut is pressed the focus is set to a search box. I have tried using the following code to detect the keypress. sWindow = new Shell(); ... sWindow.getDisplay().addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { System.out.println("Filter-ctrl: " + SWT.CTRL); System.out.println("Filter-mask: " + e.stateMask); System.out.println("Filter-char: " + e.character); } }); I was expecting that when I pressed Ctrl +

SWT Deployment as EXE

自作多情 提交于 2019-11-28 05:44:24
问题 I've recently started learning SWT (on class #4, to be precise) due to business requirements, and previously I had been developing with Swing for 2 years. We deployed Swing applications as jars with resource dependencies. In SWT, what are the deployable forms and equivalents? I have questions but since my training is online, I'm on a course-ware and there is no instructor, except StackOverflow: Can SWT apps be deployed as independent EXE's? And what's with the "Eclipse EXE" thing people talk

SWT Browser widget: html source inside jar?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 05:10:07
问题 I want to implement a help system for my tiny SWT desktop application. I've thought about a SWT browser widget containing a single html markup page and a set of anchors to navigate (there are only very few things to explain). Everything works fine, but how do I load the html file from a jar? I know about getClass().getClassLoader().getResourceAsStream("foo"); , but what is the best practice when reading from the input stream? The answer to Load a resource contained in a jar dissuades using a

Swing versus SWT

半世苍凉 提交于 2019-11-28 04:44:38
问题 What criteria should I use to choose between SWT and Swing? I assume they both provide satisfactory GUI performance and platform availability. My personal criteria currently include: layouts/layout managers; data binding; pre-built controls; ease of development. 回答1: My criteria to choose between SWT and Swing: quality and availibility of documentation (docs, books, tutorials, snippets) number of custom components (both commercial and free) quality and availibility of development tools like

Tab between fields in TableViewer

我的未来我决定 提交于 2019-11-28 04:12:37
问题 What I'd like to do is be able to tab between elements in table. I currently am creating my table like this. this.tableViewer = new TableViewer(parent , SWT.FULL_SELECTION); tableViewer.setUseHashlookup(true); table = tableViewer.getTable(); GridData gridData = new GridData(GridData.FILL_BOTH); gridData.grabExcessVerticalSpace = true; table.setLayoutData(gridData); table.setLinesVisible(true); table.setHeaderVisible(true); ... /** Create the Cell Editor Array - will hold all columns **/