swt

How to show up an image with swt in java?

十年热恋 提交于 2019-12-12 10:56:54
问题 My try as follows,which doesn't come up with anything: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Image image = new Image(display, "D:/topic.png"); GC gc = new GC(image); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.drawText("I've been drawn on",0,0,true); gc.dispose(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); // TODO Auto

How can i have a disabled Text that is scrollable?

 ̄綄美尐妖づ 提交于 2019-12-12 09:56:50
问题 My Text is declared as, Text text= new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP); It should be disabled in some cases. But when I do text.setEnabled(false); the text's scroll bar gets disabled too and i am not able to see the value in the Text completely. My Text Field cannot be READ ONLY. It should be editable in some cases. I am aware of setEditable() method in Text, but I would like to have the same behaviour as when the Text is disabled i.e, background color change,

How to get the text content on the swt table with arbitrary controls

天大地大妈咪最大 提交于 2019-12-12 09:55:54
问题 I have different controls placed on a table using TableEditor . ... TableItem [] items = table.getItems (); for (int i=0; i<items.length; i++) { TableEditor editor = new TableEditor (table); final Text text1 = new Text (table, SWT.NONE); text1.setText(listSimOnlyComponents.get(i).getName()); text1.setEditable(false); editor.grabHorizontal = true; editor.setEditor(text1, items[i], 0); editor = new TableEditor (table); final CCombo combo1 = new CCombo (table, SWT.NONE); combo1.setText(""); Set

MouseDown events are not delivered until MouseUp when a Drag Source is present

纵然是瞬间 提交于 2019-12-12 09:30:10
问题 I have a mouse listener. It has some code to respond to mouseUp and mouseDown events. This works correctly. However, as soon as I add a DragSource, my mouseDown event is no longer delivered -- until I release the mouse button! This is trivial to reproduce - below is a simple program which contains a plain shell with just a mouse listener and a drag listener. When I run this (on a Mac), and I press and hold the mouse button, nothing happens - but as soon as I release the mouse button, I

Draw in composite [closed]

折月煮酒 提交于 2019-12-12 06:50:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I have a Composite called Workspace. In this composite I want to add some graphics object. Each object can be selected, dragged, moved and can have complicated shape (circle, ellipse, polygon,...). I can click at

Search string in SWT Webbrowser Widget

放肆的年华 提交于 2019-12-12 06:24:52
问题 I wrote a program which includes the browser widget from swt. Now I navigate to google and want to search for the string "Pictures" for example. This is my code but it doesn't work: browser.addProgressListener(new ProgressAdapter() { boolean firstCompleted = false; @Override public void completed(ProgressEvent evt) { if (!firstCompleted) { String search = "Pictures"; // this row doesn't work... - not yet ;) int n = (int) browser.evaluate("return str.search(\"" + search + "\"));"); if (n == -1

NullPointerException thrown when instantiating and OleControlSite on Windows 7

老子叫甜甜 提交于 2019-12-12 05:38:39
问题 I am getting a NullPointerException when trying to open excel from SWT. Sadly I can't post the full stacktrace and some of the code because it has references to the company that I work for. Hopefully someone has run into this issue before and might recognize it. Here is the part of the stacktrace that I can post java.lang.NullPointerException at org.eclipse.swt.ole.win32.OleControlSite.disconnectEventSinks(OleControlSite.java:468) at org.eclipse.swt.ole.win32.OleControlSite

Can I move the sort arrow of an SWT table to the right instead of on top?

六月ゝ 毕业季﹏ 提交于 2019-12-12 05:29:14
问题 Is there any way to move the sort arrow from an SWT table to the right of a column header rather than on top? I know you can get rid of the arrow by not setting the image: table.setSortDirection(sortAscending ? SWT.UP : SWT.DOWN); but I haven't seen any way to move the sort indicator. Is there a way I haven't seen? Sort indicator on top: Sort indicator on the side: 来源: https://stackoverflow.com/questions/28054116/can-i-move-the-sort-arrow-of-an-swt-table-to-the-right-instead-of-on-top

restrict the ElementTreeSelectionDialog

我的未来我决定 提交于 2019-12-12 05:12:39
问题 I wanna to implement Workspace Browse . I write the below code. ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( Display.getDefault().getActiveShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider()); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.open(); How can I change the code to only root elements (projects or folders) that contains ".ecore" file shown? And when the user collapse any root elements only .ecore files shown? 回答1: You

SWT - Tweaking my ProgressMonitorDialog

旧城冷巷雨未停 提交于 2019-12-12 04:58:57
问题 I have a working ProgressMonitorDialog, but I want to make sure that I am setting it up correctly. First the Code: Method to create Dialog public void startProgressBar() { try { new ProgressMonitorDialog(getShell()).run(true, true, new ProgressBarThread()); } catch (InvocationTargetException e) { MessageDialog.openError(getShell(), "Error", e.getMessage()); } catch (InterruptedException e) { MessageDialog.openInformation(getShell(), "Cancelled", e.getMessage()); } } Class File class