swt

swt java 内嵌ActiveX控件

怎甘沉沦 提交于 2019-12-18 03:01:21
这里用的是SWT/JFace开发application中SWT自带的org.eclipse.swt.ole.win32 包可以支持内嵌OLE和ActiveX。 具体用法如下: //创建一个OleFrame做为OLE(或ActiveX)的框架 OleFrame oleFrame = new OleFrame(this, SWT.NONE); //创建ActiveX的容器,其中的classID是ActiveX的classid,在注册表中可以找到 OleControlSite oleControl = new OleControlSite(oleFrame, SWT.NONE, “classID”); //OleAutomation类用来执行ActiveX中的方法 OleAutomation oleAutomation = new OleAutomation(oleControl); //将ActiveX显示在application中 oleControl.doVerb(OLE.OLEIVERB_SHOW); 调用AcitveX中方法的具体过程: 1、不带参数的方法调用 //获取Method Name的ID,Method Name为ActiveX中具体的方法名 int[] regspid = oleAutomation.getIDsOfNames(new String[] {

SWT之ScrolledComposite

痴心易碎 提交于 2019-12-18 03:01:04
import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; public class ss { public static void main(String[] args) { Display display = new Display(); Color red = display.getSystemColor(SWT.COLOR_RED); Color blue =

Resize the column of a table to fill all the available space

自作多情 提交于 2019-12-17 21:29:57
问题 I have this table in Eclipse SWT, with 5 columns. I resize the window and together with that the whole table but the columns don't get resized to fill all the available space. Is there a layout method I can use in order to make a column resize itself to fill all the available space? I found some code that makes the columns resize when the client space has been resized but that seems like a small hack to me. There surely must be a decent elegant way of doing this by using the layout itself.

How to hide the Java SWT program icon in the Dock when the application is in the tray

家住魔仙堡 提交于 2019-12-17 20:18:49
问题 I know there are a lot of questions similar to mine, but I actually couldn't solve my problem even after reading all of them. I have a Java application that as soon as it starts it goes on tray. The problem is on Mac, because only there the icon is in the tray bar AND in the Dock. I want to get rid of the Dock icon. I did already a number of trials: try to wrap my jar in a ".app" folder and writing an Info.plist file. I inserted the LSUIElement and set it to "1" or to "true". This hides the

SWT jar for different platform

℡╲_俬逩灬. 提交于 2019-12-17 20:09:05
问题 I am using JWebBrowser in a swing application. This class belongs to The DJ Project. It needs swt jar to execute. Now I have included swt jar for windows to my jar packaging of the application. I want to know how can I include swt jars for linux/mac in the same packaging? I am using ant to build the application jar. Should I build the jar putting different swt jar for different platform? 回答1: if you want to have a single build that runs on different platforms (Win/Mac/Linux/*nix) or

How to hide an SWT composite so that it takes no space?

蓝咒 提交于 2019-12-17 19:56:57
问题 I need to hide a composite (and all children inside). Just setting setVisible(false) will keep the space of the composite. Composite outer = new Composite(parent, SWT.NONE); outer.setLayout(new GridLayout(1,false)); outer.setLayoutData(new GridData(GridData.FILL_BOTH) ); Composite compToHide = new MyComposite(outer, SWT.NONE); compToHide.setLayout(new GridLayout()); compToHide.setVisible(false); 回答1: Here is some code that does what you want. I basically use GridData#exclude in combination

Putting an image in to a JFace table Cell is causing gap for image to appear in first column

泄露秘密 提交于 2019-12-17 19:47:26
问题 So I have a problem, when I add an image to any column of a JFace table the first column also behaves like it has an image in and the text is indented by the size of that image. Here's a screenshot illustrating my point with the code needed to produce it. Is there anyway to stop this from happening because it's really getting on my wick? Regards, Glen x package widgets; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse

SWT Exception when running jar: Exception in thread “main” org.eclipse.swt.SWTException: Invalid thread access

你说的曾经没有我的故事 提交于 2019-12-17 16:52:14
问题 When executing my jar from terminal I am getting the following: ***WARNING: Display must be created on main thread due to Cocoa restrictions. Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source) at org.eclipse.swt

Creating a SWT.MOZILLA browser on Windows 64 bit and SWT 4.3

坚强是说给别人听的谎言 提交于 2019-12-17 16:51:05
问题 I'm trying to create an SWT Browser widget of the SWT.MOZILLA type under windows 8 64Bit with SWT 4.3 64Bit. According to this, SWT 4.3 should support 64 Bit version on XULRunner 10.x or 24.x So, I have downloaded both the 10.x and 24.x 64 versions from here and unzipped under c:\xulrunner10 and c:\xulrunner24 respectively. If I start my java app pointing to xulrunner10 (using the VM argument -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner10 ) it works, however if I try with xulrunner24

How to set SWT button foreground color?

∥☆過路亽.° 提交于 2019-12-17 10:05:14
问题 The SWT Button class has a setForeground(Color) method but it seems to have no effect (the method is actually on Button's superclass). The javadoc says that this method is a hint and may be overridden by the platform. My platform is Windows. Does this mean that it is not possible to set button foreground color on Windows? Does it work on other platforms? Is there a workaround? 回答1: On Windows, setForeground for Buttons has no effects. As a workaround, add a PaintListener to your Button . On