Java 如何在合成中设置正确的背景色

Java 如何在合成中设置正确的背景色,java,eclipse,swt,Java,Eclipse,Swt,我对Eclipse3.7中的面板有问题 我在面板中有一个合成图,背景为“白色”,但面板为灰色(或默认) 哪一个是我必须设置的属性,让合成的背景使用面板的背景色 正如你所见,我把复合材料放在一个“容器”里 我也有同样的问题,一组复合 提前谢谢! 致意 编辑:添加一点源代码 Composite container = new Composite(parent, SWT.NONE); this.container = container; ... Composite

我对Eclipse3.7中的面板有问题

我在面板中有一个合成图,背景为“白色”,但面板为灰色(或默认)

哪一个是我必须设置的属性,让合成的背景使用面板的背景色

正如你所见,我把复合材料放在一个“容器”里

我也有同样的问题,一组复合

提前谢谢! 致意

编辑:添加一点源代码

    Composite container = new Composite(parent, SWT.NONE);
    this.container = container;

    ...
    Composite informacion_xml = new Composite(container, SWT.NONE);
    informacion_xml.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1));
    formToolkit.adapt(informacion_xml);
    formToolkit.paintBordersFor(informacion_xml);
    informacion_xml.setLayout(new FormLayout());

    Label lblNewLabel = new Label(informacion_xml, SWT.NONE);
    FormData fd_lblNewLabel = new FormData();
    fd_lblNewLabel.top = new FormAttachment(0, 10);
    fd_lblNewLabel.left = new FormAttachment(0, 10);
    lblNewLabel.setLayoutData(fd_lblNewLabel);
    formToolkit.adapt(lblNewLabel, true, true);
    lblNewLabel.setText("Fecha y hora Exportación");

    textFechaExportacion = new Text(informacion_xml, SWT.READ_ONLY);
    fd_lblNewLabel.right = new FormAttachment(textFechaExportacion, -15);
    FormData fd_textFechaExportacion = new FormData();
    fd_textFechaExportacion.bottom = new FormAttachment(0, 27);
    fd_textFechaExportacion.top = new FormAttachment(0, 8);
    fd_textFechaExportacion.left = new FormAttachment(0, 161);
    fd_textFechaExportacion.right = new FormAttachment(63);
    textFechaExportacion.setLayoutData(fd_textFechaExportacion);
    formToolkit.adapt(textFechaExportacion, true, true);

    Label lblDispositivo = new Label(informacion_xml, SWT.NONE);
    lblDispositivo.setText("Dispositivo");
    FormData fd_lblDispositivo = new FormData();
    fd_lblDispositivo.top = new FormAttachment(lblNewLabel, 10);
    fd_lblDispositivo.left = new FormAttachment(0, 10);
    fd_lblDispositivo.bottom = new FormAttachment(67, -1);
    lblDispositivo.setLayoutData(fd_lblDispositivo);
    formToolkit.adapt(lblDispositivo, true, true);

    textDispositivo = new Text(informacion_xml, SWT.READ_ONLY);
    fd_lblDispositivo.right = new FormAttachment(textDispositivo, -15);
    FormData fd_textDispositivo = new FormData();
    fd_textDispositivo.bottom = new FormAttachment(100, -25);
    fd_textDispositivo.top = new FormAttachment(textFechaExportacion, 6);
    fd_textDispositivo.left = new FormAttachment(0, 161);
    fd_textDispositivo.right = new FormAttachment(100, -200);
    textDispositivo.setLayoutData(fd_textDispositivo);
    formToolkit.adapt(textDispositivo, true, true);
    new Label(container, SWT.NONE);

向我们展示正在生成的实际代码。还要注意的是,Eclipse3.7发布了11个版本,已经过期8年了。是一个遗留应用程序。几年前尝试升级,但没有成功…您似乎正在使用
FormToolkit
——强制使用白色背景。不要在向导页面中使用此选项。太棒了@greg-449!!我正在使用WindowBuilder编辑器。我有很多东西要学!再次感谢!