MigLayout,为什么这个单元格使用额外的space?

MigLayout, why is this cell the one using the extra space?

我有一个使用 MigLayout 为我的内容创建单元格的面板。这是代码部分:

/ ====Layout====
        setLayout(new MigLayout("hidemode 3", "[400][0][400]", "[][][][][][]"));

        Border border = BorderFactory.createLineBorder(Color.WHITE, 0);
        //setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.gray));
        // ====Components====

        // ===Information Displays===
        JLabel invName = new JLabel("inventory name");
        invName.setBorder(border);
        invName.setEnabled(false);
        add(invName, "cell 0 0, growx");
        JTextField displayName = new JTextField("display name");
        add(displayName, "cell 0 1, growx");
        JComboBox category = new JComboBox();
        category.setEditable(true);
        category.setModel(new DefaultComboBoxModel<>(new String[] {"Tops", "Skirts", "Pants", "Dresses", "Shorts"}));
        add(category, "cell 0 2, growx");
        JButton updateFields = new JButton("Update");
        add(updateFields, "cell 0 3");
        JLabel itemsLabel = new JLabel("Items in this Outfit:");
        itemsLabel.setBorder(border);
        add(itemsLabel, "cell 0 4, bottom, growy");
        JList<String> itemsInOutfit = new JList<>();
        itemsInOutfit.setVisibleRowCount(8);
        itemsInOutfit.setModel(new AbstractListModel<String>() {
            String values[] = {"item 1",
                                "item 2",
                                "item 3",
                                "item 4",
                                "item 5",
                                "item 6",
                                "item 7",
                                "item 8",
                                "item 9",
                                "item 10"
                                };
            @Override
            public int getSize() {
                return values.length;
            }

            @Override
            public String getElementAt(int index) {
                return values[index];
            }
        });
        JScrollPane scrollPane = new JScrollPane(itemsInOutfit);
        add(scrollPane, "cell 0 5, growx, bottom");
        JButton goToItem = new JButton("Go to Item");
        add(goToItem,"cell 0 6");

        // ===Items in Outfit JList===

        // ===Picture Box===

                // ---Picture Box buttons---

                JToolBar picturesBar = new JToolBar();

                JButton leftArrowBtn = new JButton();
                leftArrowBtn.setToolTipText("Previous Image");
                //leftArrowBtn.setIcon(new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/back.svg"));
                picturesBar.add(leftArrowBtn);

                JButton rightArrowBtn = new JButton();
                rightArrowBtn.setToolTipText("Next Image");
                //rightArrowBtn.setIcon(new FlatSVGIcon("com/formdev/flatlaf/demo/icons/forward.svg"));
                picturesBar.add(leftArrowBtn);

                JButton addImageBtn = new JButton();
                addImageBtn.setToolTipText("Add Image");
                addImageBtn.setIcon(UIManager.getIcon("Tree.openIcon"));
                picturesBar.add(addImageBtn);

                JButton deleteImageBtn = new JButton();
                deleteImageBtn.setToolTipText("Delete Image");
                deleteImageBtn.setIcon(UIManager.getIcon("Tree.openIcon"));
                picturesBar.add(deleteImageBtn);
                picturesBar.setFloatable(false);
                add(picturesBar, "cell 2 6, bottom, span");

                // ---Picture Box Display---
                JLabel pictureGallery = new JLabel();
                pictureGallery.setBorder(border);
                pictureGallery.setIcon(new ImageIcon(new ImageIcon("C:/users/saman/documents/projects/MyCloset/src/main/resources/the_storm_couple.jpg").getImage().getScaledInstance(400, -1, Image.SCALE_DEFAULT)));
                add(pictureGallery,"cell 2 0, span 1 6");

这是它的渲染方式:

我希望 "Items in this Outfit:" 标签位于 JList 的正上方。但是,具有 JList 的单元格是 "big" 单元格,因此我试图告诉标签对齐底部并按照该列表进行操作的尝试失败了。 当我使用单元格代码将它们添加到面板时,我尝试手动设置行和组件的高度。似乎没有任何效果。而且我也不知道如何在每个单元格上加上边框来证实我的怀疑,即实际上是 JList 单元格太高导致了问题。

我在这里做错了什么,我该如何解决?

谢谢!

我会建议

setLayout(new MigLayout("hidemode 3", "[400][0][400]", "[][][][]push[][]"));

并删除 、bottom、growy 的 itemsLabel。

我还没有测试过,所以没有保证 ;-) 另外添加调试可能会有所帮助:

new MigLayout("debug, hidemode 3", ...