窗户的右侧是切断的

时间:2015-10-26 07:10:38

标签: java eclipse user-interface

我正在使用eclipse小部件创建一个简单的窗口,其中包含TreeView和几个面板。我创建窗口的java代码在这里:

protected void createContents() {
    GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.marginBottom = 1;
    setLayout(gridLayout);

    setText("Order Inspector");
    setSize(DEFAULT_WIDTH, 500);
    setImage(SGuiUtil.getIconForShell());

    Composite searchMargin = new Composite(this, SWT.NONE);
    GridLayout searchMarginLayout = new GridLayout(2, false);
    searchMarginLayout.marginHeight = 0;
    searchMarginLayout.marginTop = 5;
    searchMarginLayout.marginBottom = 4;
    searchMarginLayout.horizontalSpacing = 0; //10;
    searchMargin.setLayout(searchMarginLayout);
    final GridData gd_searchMargin = new GridData(SWT.FILL, SWT.CENTER, false, false);
    searchMargin.setLayoutData(gd_searchMargin);

    searchText = new Text(searchMargin, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL | SWT.BORDER);
    searchText.setMessage("Search");
    final GridData gd_searchText = new GridData(SWT.FILL, SWT.CENTER, true, false);
    searchText.setLayoutData(gd_searchText);


    ToolBar inspectorToolBar = new ToolBar(searchMargin, SWT.RIGHT);
    viewOptionsToolItem = new ToolItem(inspectorToolBar, SWT.PUSH);
    viewOptionsToolItem.setImage(Images.imageWithName("/com/images/switch.png"));
    viewOptionsToolItem.setToolTipText("Inspector View Options");
    helpToolItem = new ToolItem(inspectorToolBar, SWT.PUSH);
    helpToolItem.setImage(Images.imageWithName("/com/images/icons/question-white.png"));
    helpToolItem.setToolTipText("Inspector help");


    hintText = new Label(this, SWT.WRAP);
    hintText.setText("");
    hintText.setLayoutData(notVisibleGridData());
    hintText.setVisible(false);

    treeViewer = new TreeViewer(this, SWT.FULL_SELECTION | SWT.H_SCROLL); // | SWT.V_SCROLL);
    treeViewer.setAutoExpandLevel(0);
    treeViewer.setUseHashlookup(false);

    inspectorRowFilter = new InspectorRowFilter(searchText);

    Tree tree = treeViewer.getTree();
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    tree.setLayoutData(treeGridData());

    propertyTableColumn = new TreeColumn(tree, SWT.NONE);
    propertyTableColumn.setText("Property");

    valueTableColumn = new TreeColumn(tree, SWT.NONE);
    valueTableColumn.setText("Value");
}

结果是窗口右侧切断:

Here is the screen of window with cut-off right side

如何解决?

0 个答案:

没有答案