Summary: | RFE: Please add a snipplet about SWT_AWT.new_Shell | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Jan Kümmel <eclipse-bugs> |
Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | chrriis, ericwill, ndeverge, steve_northover |
Version: | 3.3 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Jan Kümmel
2006-10-12 11:32:29 EDT
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. |