开发者

Why SWT Shell won't get expanded when using SWT_AWT bridge, linux?

开发者 https://www.devze.com 2023-03-09 16:14 出处:网络
I\'m using it in Applet. Here is source of init function: java.awt.Canvas awtParent; setLayout(new java.awt.GridLayout(1, 1));

I'm using it in Applet. Here is source of init function:

java.awt.Canvas awtParent;
setLayout(new java.awt.GridLayout(1, 1));
awtParent = new java.awt.Canvas();
add(awtParent);
display = new Display();
shell = org.eclipse.swt.awt.SWT_AWT.new_Shell(display, awtParent);
shell.setLayout(new org.eclipse.swt.layout.FillLayout());
String operatingSystem = Sy开发者_Go百科stem.getProperty("os.name").toLowerCase();
if (operatingSystem.equals("linux")) {
    GLData data = new GLData ();
    data.doubleBuffer = true;
    canvas = new GLCanvas(shell, SWT.NONE, data);
    ((GLCanvas)canvas).setCurrent();
} else {
    canvas = new Canvas(shell, SWT.EMBEDDED);
}
canvas.setLayout(new org.eclipse.swt.layout.FillLayout());
shell.open();
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
validate();
System.out.println(awtParent.getBounds());
System.out.println(shell.getBounds());
System.out.println(canvas.getBounds());

and result:

java.awt.Rectangle[x=0,y=0,width=640,height=480]
Rectangle {0, 25, 1050, 656}
Rectangle {0, 0, 0, 0}
0

精彩评论

暂无评论...
验证码 换一张
取 消