Eclipse RCP视图未出现在屏幕左侧

时间:2015-04-01 07:50:13

标签: swt eclipse-rcp

this问题中获取提示。我结束了这里,但问题是,视图正在屏幕的右侧,而不是占据整个空间。 这是当前的截图。

enter image description here

,代码是

public class MonitorView extends CoreView 
{
    public MonitorView(final Composite parent)
    {
        super(parent);
        setDisplayName(I18N("Visual Monitoring of iCommand"));
       // setLayout(new FillLayout());
        final Composite composite=GUIToolkit.newComposite(parent, SWT.FILL, new GridData(SWT.TOP,SWT.LEFT,true,true,1,1));
        FillLayout layout=new FillLayout();
        composite.setLayout(layout);
        CreatePartControl(composite);


    }

    private void CreatePartControl(Composite parent) 
    {
        // TODO Auto-generated method stub
        final Canvas canvas=new Canvas(parent,SWT.NONE);
        Color white = display.getSystemColor(SWT.COLOR_WHITE);
        canvas.setBackground(white);
        canvas.addPaintListener(new PaintListener() {
            @Override 
            public void paintControl(PaintEvent event)
            {
                int offset_x=130;
                int offset_y=70;
                int j=0,i=0,n=3,x,y;

                DrawRoundedRectangle d= new DrawRoundedRectangle();
                //for loop for column 1.Placing elements column wise. 

                for(i=0;i<n;i++)
                { x=0;y=offset_y*j;
                  d.drawrectangle(event, x, y, j);
                  j++;
                  x=0;y=offset_y*j;
                  d.drawrectangle(event, x, y, j);
                  j++;
                }

            j=0;int flag=6;
            //for loop for drawing column 2
                for(i=0;i<n;i++)
                { 
                  x=offset_x; y=offset_y*j;
                  d.drawrectangle(event, x, y, flag);
                  j++;flag++;
                  x=offset_x;y=offset_y*j;
                  d.drawrectangle(event, x, y, flag);
                  flag++;
                  j++;
                }
            }
        });

    }
}

如何将视图放在左侧并全屏显示

解决方案。请参阅问题的评论主题以供讨论

public MonitorView(final Composite parent)
    {
        super(parent);
        setDisplayName(I18N("Visual Monitoring of iCommand"));
        setLayout(new FillLayout());
        CreatePartControl(this);
   }

上面的一切都是一样的。希望它有所帮助:)

0 个答案:

没有答案