swt

Java SWT: Clear all items in a table before writing

感情迁移 提交于 2019-12-11 04:27:18
问题 How do I clear a table before writing all the rows? The data will be completely different every time I hit this code: graphicsMemoryTable.setRedraw(false); int count = 0; for(int i=0; i<graphicsMemory.size() && count<1000; i+=8,count++) { TableItem item = new TableItem(graphicsMemoryTable, SWT.NONE); item.setText(graphicsMemory.get(i).toString()); item.setText(1,graphicsMemory.get(i+1).toString()); item.setText(2,graphicsMemory.get(i+2).toString()); item.setText(3,graphicsMemory.get(i+3)

widgetSelected() and different OS platform behaviors

こ雲淡風輕ζ 提交于 2019-12-11 04:08:30
问题 I have this Java code where I implement a selectionListener . While it works great on Windows, surprisingly, it doesn't work on Linux (Debian 9.9, Cinnamon) and when I debug, the println code is never reached. Any idea why it would work on one platform (Win?) but not on another (Linux) ? DateTime dt = new DateTime(container, SWT.TIME | SWT.MEDIUM | SWT.BORDER); FormToolkit tk =new FormToolkit(parent.getDisplay()); tk.adapt(dt, true, false); dt.addSelectionListener(new SelectionAdapter() {

Simultaneously right-align and wrap text in an SWT label in Linux/Gnome

こ雲淡風輕ζ 提交于 2019-12-11 03:57:14
问题 I have a problem which appears when using Ubuntu Linux/Gnome, but seemingly not on Windows (as seen in one of the answers), that I can't use SWT.RIGHT | SWT.WRAP together, when creating a new label, in order to both make the text right-aligned and wrappable. Background: I'm using a simple 2-column Grid layout in a wizard, to create a dynamic number of rows with one label and one textfield per row. I want the labels to be of fixed size and with the text inside it right-aligned, like so: label

How to add decoration to OS specific cursor in SWT

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:29:51
问题 I'd like to change the cursor on an SWT Composite to add a small image to the standard OS arrow cursor, in the bottom right corner for instance. I imagine it will mean somehow getting hold of the Image and X,Y hotspot of the cursor but I can't figure how do do that. Any thoughts? EDIT: Following the comment this has spawned this question. 来源: https://stackoverflow.com/questions/31143499/how-to-add-decoration-to-os-specific-cursor-in-swt

TableViewer shrinks to a single row with a scroll bar when new input is set

只谈情不闲聊 提交于 2019-12-11 03:28:35
问题 I am implementing a plug-in in eclipse, which reads a set of values from a database and displays it in a TableViewer inside a ViewPart . The TableViewer uses an ArrayContentProvider as shown viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); ... viewer.setContentProvider(new ArrayContentProvider()); I also have a handler which has access to the TableViewer instance for importing data from an XML file. When the importer imports data, I

Alpha blending is slow on linux

匆匆过客 提交于 2019-12-11 03:28:05
问题 we are developing an SWT/RCP(Eclipse 3.5) application on both Windows and Linux (on identical hardware). The application is a GIS app which shows several layered maps(PNG images) rendered with alpha blending. org.eclipse.draw2d.Graphics.setAlpha(...); org.eclipse.draw2d.Graphics.drawImage(...); On Windows the performance is pretty good, but on Linux it is very poor. is that a Linux(GTK/KDE) problem? or is there any workaround to improve the performance on Linux? 来源: https://stackoverflow.com

Cross platform UI spacing/padding

旧巷老猫 提交于 2019-12-11 03:24:15
问题 I have written a Java UI using the SWT UI library and the MigLayout layout library. This page shows screenshots of the UI on Windows, Linux and OSX: http://mchr3k.github.com/org.intrace/screenshots.html On Linux and OSX my UI has a lot more padding and spacing which I feel wastes a lot of screen space. Is this normal for these platforms? If not, what is the best way to work around this? EDIT: the linked screenshots have now been updated and no longer show an extra gap on OSX as I have

Gap between search menu and its previous menu on addition of search plugin

会有一股神秘感。 提交于 2019-12-11 03:06:27
问题 I added the Search Plugin to my RCP application. On addition of this plugin it adds the search menu in main menu bar. I observed that there is some pixels gap between search menu and its previous menu. Please see the image. Does anyone know how this is coming and how I can remove it? 回答1: I fixed this issue by modifying postWindowCreate method of ApplicationWorkbenchWindowAdvisor class of RCP application. IWorkbenchPage page = this.getWindowConfigurer().getWindow().getActivePage();

Disable MouseWheel in a SWT composite

房东的猫 提交于 2019-12-11 03:05:35
问题 I created a composite using the following constructor: Composite scrolledComposite = new Composite(parent, SWT.V_SCROLL | SWT.H_SCROLL); Each time I use the mouse wheel, the vertical scroll value is changed. I know that is the default behavior, but I need to disable it. I tried to removeMouseWheelListener from the composite, but it seems that this is a native call. This is the stacktrace that could help to understand my problem. 回答1: You can add a Filter to the Display that listens for SWT

Set tooltip text for each element in an SWT Combo widget

一曲冷凌霜 提交于 2019-12-11 02:55:08
问题 I've been looking around for ages and can't seem to find whether this is possible or not. I have a Combo widget populated with some strings and wan't to set the tool tip text to be something different for each item in the Combo widget. i.e. When you mouse over an item in the Combo widget a string is displayed above the mouse icon. For example if there are 2 items in the Combo widget, Foo and Bar, can you set the tool tip text to be "Foo" when you mouse over Foo and "Bar" when you mouse over