Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在eclipse插件中定位组件?_Java_Eclipse_Eclipse Rcp_Eclipse Plugin - Fatal编程技术网

Java 如何在eclipse插件中定位组件?

Java 如何在eclipse插件中定位组件?,java,eclipse,eclipse-rcp,eclipse-plugin,Java,Eclipse,Eclipse Rcp,Eclipse Plugin,给定Eclipse视图中提供给我的默认容器,我希望确定AWT框架和SWT标签的方向。我希望SWT标签位于顶部,AWT框架位于其正下方。由于某些原因,我无法使SWT标签在框架所在位置之外绘制。我希望它们是分开的,但是RowLayout似乎没有将组件放入孤立的行中 SWT标签不希望被放置在AWT框架内: 插件视图中的代码: public void createPartControl(Composite parent) { container = new Composite(parent,

给定Eclipse视图中提供给我的默认容器,我希望确定AWT框架和SWT标签的方向。我希望SWT标签位于顶部,AWT框架位于其正下方。由于某些原因,我无法使SWT标签在框架所在位置之外绘制。我希望它们是分开的,但是RowLayout似乎没有将组件放入孤立的行中

SWT标签不希望被放置在AWT框架内:

插件视图中的代码:

public void createPartControl(Composite parent) {

    container = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
    RowLayout rowLayout = new RowLayout();
    //I have tried toggling many of the RowLayout properties but this has no effect on placing the label outside of the AWT Frame.
    container.setLayout(rowLayout);

    Label topLabel = new Label(container, SWT.NONE);
    topLabel.setText("MY NEW LABEL");

    frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(container);
    frame.setFocusable(true);
    frame.setFocusableWindowState(true);
RowLayout
从不将组件放在单独的行中,而是将它们放在一行中。您可以使用
SWT.VERTICAL
样式创建它,以便行从上到下而不是从左到右。然而,截图仍然是错误的。将框架作为其自身组合的唯一子级可能会有所帮助:

container = new Composite(parent, SWT.NONE);
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
container.setLayout(rowLayout);

Label topLabel = new Label(container, SWT.NONE);
topLabel.setText("MY NEW LABEL");

Composite frameContainer = new Composite(container, SWT.EMBEDDED | SWT.NO_BACKGROUND);
frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(frameContainer);
frame.setFocusable(true);
frame.setFocusableWindowState(true);