swt

SWT Combo and CCombo as CellEditor

好久不见. 提交于 2019-12-10 11:35:48
问题 Why is the last item blank? I only have 3 items (it's a tri-state boolean editor). Can a CCombo achieve this solid Combo look and feel? As a combo cell editor, I would prefer the regular Combo , BUT: Can this Combo be used as CellEditor , while fitting the table row height? (maybe making the Font smaller?) 回答1: The default visible item count for CCombo is 5, try calling setVisibleItemCount(3) . CCombo does not support much customization. It always sets the same colors for the list and the

How can i open a shell without making it active?

天大地大妈咪最大 提交于 2019-12-10 11:16:32
问题 I need to know if there is any way to open a shell and not make it active, even if i click a control in it. The best way to explain what i need is to show you this little example. I need to keep the first shell active, even if i click the second one, or any widget that it contains. public class TestMeOut { public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); final Shell shell2 =

How to navigate down with enter key in SWT TableViewer

余生颓废 提交于 2019-12-10 10:56:20
问题 I have a TableViewer and want the selection to go down one cell when I press the enter key, much like in MS Excel. I implemented my own CellNavigationStrategy with the following findSelectedCell . public ViewerCell findSelectedCell(ColumnViewer viewer, ViewerCell currentSelectedCell, Event event) { if (event.type == ColumnViewerEditorActivationEvent.KEY_PRESSED) { if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { ViewerCell nextCell = currentSelectedCell .getNeighbor(ViewerCell

How to add a row to a table using swt

不羁的心 提交于 2019-12-10 10:47:54
问题 I am learning swing and have one doubt regarding insertion of row to a table. My requirement is such that I have to add a new row by pressing a add button. But I am not able to proceed. please find the code below: If some one know please help me.... {public class TableShellExample { Display d; Shell s; TableViewer tableViewer; CellEditor cellEditor; TableShellExample(){ d = new Display(); s = new Shell(); s.setSize(250,250); s.setText("Table Shell Example"); GridLayout g1 = new GridLayout();

Draggable toolbar

孤街醉人 提交于 2019-12-10 10:39:22
问题 how to make draggable/dockable toolbar with JFace/SWT like Eclipse has? Could you post a simple example of ApplicationWindow or link good source of how to make it. Thanks. 回答1: SWT has a component called CoolBar, You can create CoolBars fairly easily by using CoolBarManager, or you can manually use just them (API Doc) 回答2: In case that someone found this question I have prepared small example. My problem was in incorrect use of add method. You have to use add(IToolBarManager toolBarManager)

SWT Image to/from String

爷,独闯天下 提交于 2019-12-10 10:35:12
问题 I am trying to convert an SWT Image to String and vice versa: To String: Display display = new Display(); final Image image = new Image(display, "c:\test.png"); // Looks good showImage(image ,600,400); ImageData imageData = testImage.getImageData(); byte[] data = imageData.data; String imageString = new String(Base64.encode(data)); Back to image: byte[] decode = Base64.decode(imageString.getBytes()); decode.toString(); Image c_img = new Image(Display.getCurrent(), stringToInputStream(decode

NoClassDefFoundError on JFace FontRegistry

浪尽此生 提交于 2019-12-10 10:23:29
问题 When I launch an SWT application (via an Eclipse launch profile), I receive the following stack trace: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jface/resource/FontRegistry at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:338) at org.eclipse.jface.window.Window.close(Window.java:313) at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:971) at org.eclipse.jface.dialogs.ProgressMonitorDialog.close(ProgressMonitorDialog.java:348) at

Converting an AWT application to SWT/JFace

末鹿安然 提交于 2019-12-10 08:46:29
问题 I am currently toying with the idea of converting a small/medium sized project from AWT to SWT, although Swing is not totally out of the picture yet. I was thinking about converting the main window to an SWT_AWT bridge object, but I have no idea how the semantics for this work. After that, I plan to update dialog for dialog, but not necessarily within one release. Is this possible? Has someone done a conversion like this and can give me some hints? Is there maybe even a tutorial somewhere out

package GDAL JAVA Binding and native library in a SWT plugin

霸气de小男生 提交于 2019-12-10 03:54:21
问题 I want to package GDAL and its JAVA binding into a SWT plug-in. (P.S. GDAL use swig to generate Java binding) I have all necessary native libraries and want to pack them into my Eclipse plug-in to let other people use it without installing GDAL on their computer. The problem is that the JAVA Binding (or native lib itself) will lookup necessary native libraries from PATH (Window) or LD_LIBRARY_PATH (Linux) instead looking up those libs in a relative location. Furthermore, GDAL will look up

Blinking background rows of TableViewer or TreeViewer in SWT

北城余情 提交于 2019-12-10 03:19:23
问题 I need the ability to have a blinking (red, maybe more colors) background for rows in a TableViewer/TreeViewer. What are the best options? There may be more than one row blinking, the blinking MUST be synchron and I need two blinking modes, fast and slow. 回答1: I would do something similar to this. Update the elements that you need to change the colors for at a regular interval. At each update toggle the colors depending on how you want them to flash. void scheduleColorChange(final Color