[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] SWT_AWT.new_Shell() with GTK2 : no SWT Widget display
|
Hi,
When I try to embed SWT Component in AWT Component with GTK2, the main
UI (Frame) comes up but the SWT widget is not displayed, ie I can't see
the Button component (I only see Swing component). I tried various
examples, and the SWT components never show, and no error is returned.
If I try a "xwininfo --children -all" on the window, I get the following :
Parent window id: 0xe01142 (has no name)
1 child:
0x2a00008 "Content window": ("sun-awt-X11-XContentWindow"
"moulinette-TestAWTSWT") 300x300+-4+-20 +20+20
2 children:
0x2a0000a "sun-awt-X11-XButtonPeer": ("sun-awt-X11-XButtonPeer"
"moulinette-TestAWTSWT") 290x23+5+25 +25+45
0x2a0000c "sun-awt-X11-XCanvasPeer": ("sun-awt-X11-XCanvasPeer"
"moulinette-TestAWTSWT") 290x247+5+48 +25+68
1 child:
0x2c0001f "": ("SWT" "SWT") 1x1+0+0 +25+68
2 children:
0x2c00021 (has no name): () 290x247+0+0 +25+68
1 child:
0x2c00022 (has no name): () 290x247+0+0 +25+68
0x2c00020 (has no name): () 1x1+-1+-1 +24+67
So it seems that the SWT Component is created, but it is not diplayed.
I tested it on Fedora Core 3 with GTK2, Mandrake 8.1 with GTK2, with
JDK1.4.2_05 and JDK1.5.0_06.
On SWT 3.1, the SWT_AWT.new_Shell() method never return, so I installed
SWT 3.2 (correction of bug 91364), the SWT_AWT.new_Shell() method
returns, but no widget is displayed.
Here is the test 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();
}
}
Any idea ?
--
Nico