swt

Scrolling SWT Table programmatically

三世轮回 提交于 2019-11-30 08:47:58
How to do vertical scroll of SWT table programatically? I'm implementing search function on the table. When an item was found then it will be scrolled to the item found. There are several methods you might want to try: Table.showItem(TableItem) Table.showSelection() Table.showColumn(TableColumn) Table.setTopIndex(int) Other than that, I suggest using a TableViewer from JFace . Then you'd scroll to an item with this method: TableViewer.reveal(Object) My full time job is to develop SWT (on Linux), I hope to be able to provide a comprehensive answer: From a SWT code point of view (at least on on

How to use log4j in an Eclipse RCP?

半世苍凉 提交于 2019-11-30 08:36:49
问题 How to use log4j logging API in an Eclipse RCP project? As a workaround U tried to create a new OSGI Bundle which has a log4j jars, below is the bundle structure: I've crated a basic RCP application with a view (template) named loggingtest .I've included the bundle log4j in the dependencies tab of loggingtest project.In the Activator start method i placed the following code Logger logger = Logger.getLogger(Activator.class); logger.info("Info starting"); logger.warn("Warning starting"); logger

SWT Java: How to prevent window from resizing?

↘锁芯ラ 提交于 2019-11-30 08:27:05
问题 I want to disable resizing of window. Any ideas? 回答1: You can specify the Shell style bits by using the two-arg constructor. The default style bits are SWT.SHELL_TRIM : public static final int SHELL_TRIM = CLOSE | TITLE | MIN | MAX | RESIZE; You actually want to exclude the RESIZE bit. If you're creating your own Shell : final Shell shell = new Shell(parentShell, SWT.SHELL_TRIM & (~SWT.RESIZE)); If you're extending Dialog , you can influence the shell style bits by overridding getShellStyle :

Handle custom URL schemes in an OS X Java application

你。 提交于 2019-11-30 07:19:41
问题 The Info.plist of our Java-based application contains following entries: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> ... <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>myApp handler</string> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict> </array> ... </dict> </plist> It should handle an URL like myapp://foobar/bazz . Opening the

How do you build an SWT application with Maven

依然范特西╮ 提交于 2019-11-30 06:02:11
I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get: Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1030) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:100) at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:19) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) at org

Setting Colors in SWT

[亡魂溺海] 提交于 2019-11-30 05:34:23
This is pretty simple, I come from a swing/awt background. I'm just wondering what the proper way to set the background color for a SWT widget is? I've been trying: widget.setBackground( ); Except I have no idea how to create the color Object in SWT? To create a color, try this: Device device = Display.getCurrent (); Color red = new Color (device, 255, 0, 0); qualidafial For standard colors (including common colors and default colors used by the operating system) Use Display.getSystemColor(int) , and pass in the SWT.COLOR_* constant for the color you want. Display display = Display.getCurrent(

How to add Hyperlink in SWT Table`s column?

纵饮孤独 提交于 2019-11-30 05:25:31
问题 How to add Hyperlink in SWT Table column ? I`m using org.eclipse.swt.widgets.Table class. Is there any way to do this without using TableViewer, JFace ? I tried this way but not working correctly (not showing hyperlinks). for(int i=2; i<4; i++){ Hyperlink link = new Hyperlink(table, SWT.WRAP); link.setText(temp[i]); link.setUnderlined(true); TableEditor editor = new TableEditor(table); editor.setEditor(link, tableItem[index-1], i); //set hyperlinks in column i } 回答1: Yes, that is certainly

Create a custom button with SWT

五迷三道 提交于 2019-11-30 04:27:59
问题 I would like to ask the same thing than this question but using SWT: Is there a way to make a Button with your own button graphic not just with an image inside the button? If not is another way to create a custom button in java? 回答1: public class ImageButton extends Canvas { private int mouse = 0; private boolean hit = false; public ImageButton(Composite parent, int style) { super(parent, style); this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { switch

How to draw over child elements of a Composite in SWT?

时间秒杀一切 提交于 2019-11-30 03:53:20
问题 I understand to draw on a Composite, you can add a paint listener, but that results in drawing under the children. What if I want to draw over the top of children? The following draws a line, but subc is drawn over it. Composite c = new Composite(shell, 0); c.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); c.setBounds(100, 100, 800, 600); c.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 500, 1000); } }); final Composite

Java 7 breaks SWT app on OS X using Web Start

岁酱吖の 提交于 2019-11-30 03:52:05
问题 We have an application that launches via webstart that uses the SWT library. It's well known that osx requires the swt library to run in the main thread, so we have this in our jnlp: <resources os="Mac"> <j2se version="1.6+" java-vm-args="-XstartOnFirstThread"/> <jar href="swt-mac64.jar"/> </resources> Since we've upgraded to Java 7 (1.7.0_10), it seems that webstart doesn't pass the "-XstartOnFirstThread" to the java process that it starts. I can see from 'ps' that the java process isn't