java中的布局帧/组合swt

java中的布局帧/组合swt,java,eclipse,swt,composite,Java,Eclipse,Swt,Composite,如何设置窗框在窗口中的位置?如果我现在运行程序,它会在屏幕左上角显示小尺寸的框架。我试着把尺寸调大一点,但还是不走运 protected void createContents() { shell = new Shell(); shell.setSize(800, 600); shell.setText("E-MAIL"); shell.setLayout(new FormLayout()); //I want this

如何设置窗框在窗口中的位置?如果我现在运行程序,它会在屏幕左上角显示小尺寸的框架。我试着把尺寸调大一点,但还是不走运

    protected void createContents() {
        shell = new Shell();
        shell.setSize(800, 600);
        shell.setText("E-MAIL");
        shell.setLayout(new FormLayout());


//I want this part to be displayed on the middle of the window screen

        Composite composite = new Composite(shell, SWT.NO_BACKGROUND | SWT.EMBEDDED);
        Frame frame = SWT_AWT.new_Frame(composite);     
        HTMLEditor htmlEditor = new HTMLEditor();
        frame.add(htmlEditor);
}
有什么帮助吗

谢谢。

更改:

shell.setLayout(null);
在frame.addhtmleditor;之前添加:


用数字更改x、y、宽度和高度,以调整框架的大小和位置。

感谢您的快速回复。。已经尝试过了,但仍显示在屏幕左上角。。你能编辑代码吗?也许我做错了。。thanksOk,而不是框架。setBoundsx,y,宽度,高度;尝试使用htmleditor.setBoundsx,y,width,height;在将html编辑器添加到框架之前。你能给我所有的代码或项目,这样我就可以在我的电脑上运行它并尝试修复它吗?无论如何,所有的代码都应该发布,这样我们就可以看到createContents在哪里/如何被调用。嗯,这不是一个项目或任何东西,我只是在测试一些东西,但无论如何,我怎样才能把项目发送给你?我应该发邮件给你吗?还是像你想的那样。。电邮:marcellodavi98@gmail.com或者上传到某个地方,比如mediafire。。。
frame.setBounds(x,y,width,height);