Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.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
Layout 如何使元素随着布局无限增长?_Layout_Groovy_Miglayout_Griffon - Fatal编程技术网

Layout 如何使元素随着布局无限增长?

Layout 如何使元素随着布局无限增长?,layout,groovy,miglayout,griffon,Layout,Groovy,Miglayout,Griffon,我被投入了一个落后于计划的桌面应用程序项目,希望能让项目重新启动,但遗憾的是,我在桌面应用程序开发方面经验很少 我的前任校长似乎知道他在做什么,但从来没有完成过任何事情,所以我只能努力收拾残局,把项目赶出去 该应用程序使用Griffon作为框架,使用MigLayout作为布局管理器,我想我掌握了其中的大部分诀窍,但我不知道如何获得规范要求的增长行为 以下是我正在处理的观点: application(title: 'MyApp', preferredSize: [320, 240]

我被投入了一个落后于计划的桌面应用程序项目,希望能让项目重新启动,但遗憾的是,我在桌面应用程序开发方面经验很少

我的前任校长似乎知道他在做什么,但从来没有完成过任何事情,所以我只能努力收拾残局,把项目赶出去

该应用程序使用Griffon作为框架,使用MigLayout作为布局管理器,我想我掌握了其中的大部分诀窍,但我不知道如何获得规范要求的增长行为

以下是我正在处理的观点:

application(title: 'MyApp',
        preferredSize: [320, 240],
        pack: true,
        locationByPlatform: true,
        iconImage: imageIcon('/griffon-icon-48x48.png').image,
        iconImages: [imageIcon('/griffon-icon-48x48.png').image,
                imageIcon('/griffon-icon-32x32.png').image,
                imageIcon('/griffon-icon-16x16.png').image]) {
    panel(layout: new MigLayout()) {
        label 'Root Directory:', constraints: 'split, span'
        textField text: 'Put RootDir here', constraints: 'growx'
        button 'Dialog', constraints: 'wrap'

        label 'To be Processed:'
        button 'Go button', constraints: 'spany 3'
        label 'Processed:', constraints: 'wrap'

        scrollPane(constraints: 'center, grow') {
            list listData: (1..20).collect { "Very Long Line $it" }
        }
        scrollPane(constraints: 'center, grow, wrap') {
            list listData: (1..5).collect { "Line $it" }
        }

        label 'info about files'
        label 'info about files', constraints: 'wrap'

        progressBar constraints: 'span, growx, wrap'
        progressBar constraints: 'span, growx'
    }
}
当我将窗口拉大时,顶部的文本字段和底部的两个进度条应水平拉伸以填充空间,两个列表应向两个方向拉伸。其余元素的大小应保持不变

不管我怎么做,如果我将顶部文本框设置为
columns
属性非常大,我只能使其拉伸,即使如此,它也只会显示出许多列,而不是更大的列

列表也不会垂直增长,我所能得到的最好结果就是让右边的列表增长到未知的大小,然后左边的列表会增长

进度条将增长到与包含面板一样大,如果我可以让包含面板填充整个窗口,这很好

那么,我遗漏了什么关键部分?我相信这是一个很小的因素,但不管我怎么努力,我似乎都无法让事情正常发展。非常感谢您的帮助。

试试看

panel(layout: new MigLayout(**"fillx"**)) {

我认为问题在于您的根面板没有调整大小,因此该面板内部的任何元素都不需要调整大小

尝试更改:

panel(layout: new MigLayout()) {


正如其他人所评论的,在实例化MigLayout时,必须设置适当的布局约束。 如果您有,那么代码可以缩短为以下内容

application(title: ...) {
    migLayout layoutConstraints: 'fill'
    label 'Root Directory:', constraints: 'split, span'
    ...
}

使用“fill”而不是“fillx”的优点。我只注意到两个窗格上的“生长”,没有注意到“生长”。
application(title: ...) {
    migLayout layoutConstraints: 'fill'
    label 'Root Directory:', constraints: 'split, span'
    ...
}