我的网格包有问题(我会在最后发布代码)
格栅包有多个面板,包括2个滚动面板。
当用户尝试调整表单大小时,会出现问题。
首先它的尺寸正确,所有面板都能正确拉伸,直到它达到上部scollpane伸展到滚动条消失的程度,此时下部滚动盘尺寸下降,留下很大的间隙在顶部滚动窗格和中间的按钮之间
在设计视图(JDEV)中查看它看起来很好,我看不到会导致这种情况的任何事情。我已经尝试将MainPanel放到另一个Panel作为基础,这没有任何区别。
如果任何机构有任何想法,我欢迎听到。我认为它已经到了我无法看到木头的树木
this.getContentPane().setLayout(borderLayout1);
this.getContentPane().add(MainPanel, BorderLayout.CENTER);
FieldPanel.setLayout(gridBagLayout2);
FormPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
MainPanel.setLayout(gridBagLayout1);
ButtonPanel.setLayout(gridBagLayout3);
BottomPanel.setLayout(gridBagLayout5);
TopPanel.setLayout(gridBagLayout6);
WorkflowButtonPanel.setLayout(gridBagLayout4);
SQLScrollPane.setPreferredSize(new Dimension(50, 80));
SQLScrollPane.setMinimumSize(new Dimension(50, 80));
WorkflowTable.setName("WorkFlowRulesWorkFlowTable");
WorkflowScrollPane.setBorder(BorderFactory.createTitledBorder("WorkFlow"));
FieldPanel.add(WorkFlowRulesIDLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
TopPanel.add(FieldPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 3, 3), 0, 0));
WorkflowScrollPane.getViewport().add(WorkflowTable, null);
TopPanel.add(WorkflowScrollPane, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 2, 0), 0, 0));
BottomPanel.add(WorkflowButtonPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 2, 3, 3), 0, 0));
SQLScrollPane.getViewport().add(SQLTextArea, null);
BottomPanel.add(SQLScrollPane, new GridBagConstraints(0, 2, 1, 1, 1.0, 2.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 0, 0, 0), 0, 140));
MainPanel.add(TopPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
MainPanel.add(BottomPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
MainPanel.add(ButtonPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 2, 3, 3), 0, 0));
FieldPanel.add(WorkFlowRulesIDField, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(UserRefLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(UserRefField, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(ExtRefLabel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(ExtRefField, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(DescriptionLabel, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(DescriptionField, new GridBagConstraints(1, 3, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(DescriptionLabel2, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(DescriptionField2, new GridBagConstraints(1, 4, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(PriorityLevelLabel, new GridBagConstraints(0, 5, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(PriorityLevelField, new GridBagConstraints(1, 5, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(StatusFlagLabel, new GridBagConstraints(0, 6, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
FieldPanel.add(StatusFlagComboBox, new GridBagConstraints(1, 6, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
ButtonPanel.add(DestinationWorkflowLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
ButtonPanel.add(DestinationWorkflowComboBox, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
ButtonPanel.add(SaveButton, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
ButtonPanel.add(CancelButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
ButtonPanel.add(TestButton, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
WorkflowButtonPanel.add(AddButton, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
WorkflowButtonPanel.add(DeleteButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(2, 2, 3, 3), 0, 0));
this.getContentPane().add(MainPanel, BorderLayout.CENTER);