Community
Participate
Working Groups
I am unable to embed swt widgets to a swing component using SWT_AWT.new_Shell on linux/gtk2 while the same code seems to run on win32. Please add a snipplet which shows how to embed swt into awt correctly. Such a snipplet would make it possible to see whether there a bug in swt or I am simply too stupid to use it right ;-)
I have a similar problem, the SWT Widgets are not displayed in my AWT Frame. Here is the code : public static void main(String[] args) { java.awt.Frame frame = new java.awt.Frame("AWT Frame"); java.awt.Button button = new java.awt.Button("AWT Button"); frame.add(button, java.awt.BorderLayout.NORTH); java.awt.Canvas canvas = new java.awt.Canvas(); frame.add(canvas, java.awt.BorderLayout.CENTER); frame.addNotify(); Display display = new Display(); Shell shell = SWT_AWT.new_Shell(display, canvas); shell.setLayout(new FillLayout()); Button swtButton = new Button(shell, SWT.PUSH); swtButton.setText("SWT Button"); frame.setBounds(20, 20, 300, 300); shell.layout(); frame.setVisible(true); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
> I am unable to embed swt widgets to a swing component using SWT_AWT.new_Shell on linux/gtk2 while the same code seems to run on win32. Maybe it is because you are using Java 5 or that you are not setting the "sun.awt.xembedserver" system property to true, as discussed in bug 161911. Note that about the Linux Java 5 support, there is a bug in Sun's bug database you could vote for: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6671386 +1 for a snippet that shows the new_Shell functionality though.
Tossing back into the pool to see if anyone wants to work on this.