Main /
EclipseAndAWTEclipse and AWTIn Eclipse 3.0, APIs have been introduced for integrating AWT and Swing with SWT. This support is “product-quality” on Windows and has only early access support on Linux under JDK 1.5. The main entry point for AWT integration is the class SWT_AWT. It provides a factory method, new_Frame, that creates an AWT Frame that is parented within an SWT Composite. From there, you can create whatever AWT components you want within that frame. The bridging layer created by SWT_AWT handles forwarding of SWT events to the corresponding AWT events within the frame.
See Also: FAQ Is SWT better than Swing?
A: Yes. As of Eclipse 3.2, Swing and AWT can be embedded in SWT on Windows, Motif, GTK and OS X. However it is important to note that a supporting JDK is required on some platforms in order for this to work. Specifically, Motif and GTK require that JDK 1.5 or newer be used, and OS X requires that the JDK specified in Why does the SWT_AWT bridge not work for me on OS X? be used. Additionally, AIX and Solaris users must ensure that AWT is using XToolkit, as described in Why does the SWT_AWT bridge not work for me on AIX or Solaris?
See this snippet for an example of how to use the API.
Embedding Vergil in SWT
Issues with the AWT SWT BridgeRunning the Locking assertion failure. Backtrace: #0 /usr/lib/libxcb-xlib.so.0 [0xb0873767] #1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0x31) [0xb08738b1] #2 /usr/lib/libX11.so.6(_XReply+0xfd) [0xb0b521bd] #3 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0xb01a4dce] #4 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0xb018ed77] #5 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so [0xb018eef3] #6 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0x26) [0xb018f136] #7 [0xb25cfbfa] #8 [0xb25c9b3b] #9 [0xb25c9b3b] #10 [0xb25c7219] #11 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/client/libjvm.so [0xb777c2bc] #12 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/client/libjvm.so [0xb7890ed8] #13 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/client/libjvm.so [0xb777c0ef] #14 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/client/libjvm.so(JVM_DoPrivileged+0x32d) [0xb77d9b9d] #15 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3d) [0xb757b30d] #16 [0xb25cf4ab] #17 [0xb25c9a64] #18 [0xb25c7219] #19 /usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/client/libjvm.so [0xb777c2bc] 516 ms. Memory: 4540K Free: 953K (21%)
Converting Plot to SWTChris Motika created a small plugin version of the Ptplot code. To access it,
Problem: Running PlotApplication within Eclipse failsRunning Plot Application works: cd org.ptolemy.plot/bin java -classpath . org.ptolemy.plot.PlotApplication Running PlotApplication from Eclipse fails: 2010-09-09 21:17:50.884 java[47596:80f] [Java CocoaComponent compatibility mode]: Enabled 2010-09-09 21:17:50.885 java[47596:80f] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000 2010-09-09 21:17:51.553 java[47596:13b03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1b99b0> '(null)') unlocked when not locked 2010-09-09 21:17:51.555 java[47596:13b03] *** Break on _NSLockError() to debug. 2010-09-09 21:17:51.658 java[47596:13b03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1ba440> '(null)') unlocked when not locked 2010-09-09 21:17:51.659 java[47596:13b03] *** Break on _NSLockError() to debug. 2010-09-09 21:17:51.789 java[47596:13b03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x11c880> '(null)') unlocked when not locked 2010-09-09 21:17:51.790 java[47596:13b03] *** Break on _NSLockError() to debug. 2010-09-09 21:17:51.891 java[47596:13b03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1bcba0> '(null)') unlocked when not locked 2010-09-09 21:17:51.892 java[47596:13b03] *** Break on _NSLockError() to debug. 2010-09-09 21:17:51.994 java[47596:13b03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x1bcde0> '(null)') unlocked when not locked 2010-09-09 21:17:51.996 java[47596:13b03] *** Break on _NSLockError() to debug. Searching the web indicates that the problem has to do with the AWT_SWT bridge. |