swt

How can I put a “(de)select all” check box in an SWT Table header?

坚强是说给别人听的谎言 提交于 2019-12-01 15:34:58
问题 I have an SWT Table that I'm instantiating with the SWT.CHECK style in order to display a check box next to every row. My users have requested another check box in the header row of the table in order to allow them to select/deselect all the rows with one click. I can't see any obvious way to do it, and I've only found Swing/JTable examples through Google. Does anyone know how to do this? I'm hoping it's possible without re-implementing Table or falling back on a header context menu. 回答1:

Adding right click menu to to treeitem in SWT tree

寵の児 提交于 2019-12-01 15:19:12
问题 How can I add a right click popup menu to a treeitem in a SWT Tree. Each treeitem should have a right click enabled on it 回答1: Just use tree.setMenu(Menu) . There you go: public static void main(String[] args) { Display display = Display.getDefault(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); final Tree tree = new Tree(shell, SWT.NONE); for(int i = 0; i < 10; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText(

Create a balloon tool tip for text box?

为君一笑 提交于 2019-12-01 13:38:37
How to create a balloon tool tip for a text box in SWT? Here is a modified SWT snippet which shows how to add balloon tooltip to SWT Text instance. Next time please consider to ask more specifically, I don't now, if this is what are you looking for.. /* * Tooltip example snippet: create a balloon tooltip for a tray item * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ * * @since 3.2 */ import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.graphics.Point; import org.eclipse

Fatal error running an SWT application from OpenOffice

依然范特西╮ 提交于 2019-12-01 13:11:00
I have an OpenOffice Java addon application. I'm calling SWT from an XActionListener . Loading of SWT is done dynamically using a special class loader. The SWT window displays well, but when I hit the close button of an SWT window I get an error. I'm attaching the error file generated by this error. What is the meaning of this error? My SWT code final Display display = Display.getDefault(); final Shell shell = new Shell(); shell.setLayout(new FillLayout(SWT.VERTICAL)); shell.setSize(500, 375); shell.setText("SWT Application"); final Browser browser = new Browser(shell, SWT.NONE); browser

Why does JfileChooser.showOpenDialog hang on Mac OSX?

自闭症网瘾萝莉.ら 提交于 2019-12-01 12:47:12
I am using Eclipse to develop an SWT application. The following code works on Windows but not on Macintosh: import javax.swing.JFileChooser; public class Test { public static void main(String[] args) { final JFileChooser fc = new JFileChooser(); int ret = fc.showOpenDialog(null); System.out.println("ret = " + ret); } } Upon entering showOpenDialog , the Mac cursor spins forever, and I get the following in the Java console: 2013-09-05 08:20:40.568 java[1271:707] [Java CocoaComponent compatibility mode]: Enabled 2013-09-05 08:20:40.569 java[1271:707] [Java CocoaComponent compatibility mode]:

Why does JfileChooser.showOpenDialog hang on Mac OSX?

北战南征 提交于 2019-12-01 12:21:45
问题 I am using Eclipse to develop an SWT application. The following code works on Windows but not on Macintosh: import javax.swing.JFileChooser; public class Test { public static void main(String[] args) { final JFileChooser fc = new JFileChooser(); int ret = fc.showOpenDialog(null); System.out.println("ret = " + ret); } } Upon entering showOpenDialog , the Mac cursor spins forever, and I get the following in the Java console: 2013-09-05 08:20:40.568 java[1271:707] [Java CocoaComponent

Create a balloon tool tip for text box?

流过昼夜 提交于 2019-12-01 11:35:27
问题 How to create a balloon tool tip for a text box in SWT? 回答1: Here is a modified SWT snippet which shows how to add balloon tooltip to SWT Text instance. Next time please consider to ask more specifically, I don't now, if this is what are you looking for.. /* * Tooltip example snippet: create a balloon tooltip for a tray item * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ * * @since 3.2 */ import org.eclipse.swt.SWT; import org.eclipse.swt.events

swt table has limitation on text length in a cell?

大兔子大兔子 提交于 2019-12-01 11:01:35
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 reserved. This program and the accompanying materials * are made available under the terms of the Eclipse

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

穿精又带淫゛_ 提交于 2019-12-01 10:22:11
问题 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? 回答1: 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

SWT Table Sorting by clicking the column header

心不动则不痛 提交于 2019-12-01 09:36:36
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" }); Listener sortListener = new Listener() { public void handleEvent(Event e) { TableItem[] items = table