Eclipse 偏好 - 网格布局混乱

发布于 2024-11-17 11:03:36 字数 665 浏览 8 评论 0原文

我尝试构建 Eclipse pref 页面的一部分,其中包含表格和添加/删除按钮。我找到了一些示例代码,但我不明白以下内容:

该方法

protected void adjustForNumColumns(int numColumns) {
    ((GridData)top.getLayoutData()).horizontalSpan = numColumns;
}

将父(顶部)组合的水平跨度设置为列数。

该方法

protected void doFillIntoGrid(Composite parent, int numColumns) {
    top = parent;

    // set layout
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    top.setLayoutData(gd); ... }

设置布局,水平跨度设置为列数。

何时以及为什么列数以某种方式应用于网格数据对象两次,使用哪种方法?这可能是一个非常愚蠢的问题,但我刚刚开始了解整个事情......有人可以向我解释它是如何工作的吗? (或者甚至参考一个不错的网页,我可以在其中找到解释)

I try to build a part of an eclipse pref page which contains a table and add/remove-buttons. I have found some example code but I don't understand the following thing:

The method

protected void adjustForNumColumns(int numColumns) {
    ((GridData)top.getLayoutData()).horizontalSpan = numColumns;
}

sets the horizontal span for the parent (top) composite to the number of columns.

And the method

protected void doFillIntoGrid(Composite parent, int numColumns) {
    top = parent;

    // set layout
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    top.setLayoutData(gd); ... }

sets the layout with the horizontal span set to the number of columns.

Which method is used when and why is the number of columns somehow applied twice to a grid data object? It might be a pretty stupid question but I just started with the whole thing... Can anybody explain to me how it works? (Or even refer to a nice webpage where I can find an explanation)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文