Java 网格袋大小不相等
我对gridbags有问题(我会在最后发布代码) gridbag有几个面板,包括2个滚动面板 当用户试图调整表单大小时,问题就出现了 首先,它的大小正确,所有面板都正确拉伸,直到它到达上滚动窗格拉伸到滚动条消失的点,此时下滚动窗格的大小减小,在顶部滚动窗格和中间的按钮之间留下很大的间隙 从设计视图(JDEV)来看,一切看起来都很好,我看不到任何可能导致这种情况的因素。我试着把主面板放在另一个面板上作为底座,这没有什么区别 如果有任何机构有任何想法,我都欢迎听取。我想这已经到了我看不见树木的地步Java 网格袋大小不相等,java,jdeveloper,Java,Jdeveloper,我对gridbags有问题(我会在最后发布代码) gridbag有几个面板,包括2个滚动面板 当用户试图调整表单大小时,问题就出现了 首先,它的大小正确,所有面板都正确拉伸,直到它到达上滚动窗格拉伸到滚动条消失的点,此时下滚动窗格的大小减小,在顶部滚动窗格和中间的按钮之间留下很大的间隙 从设计视图(JDEV)来看,一切看起来都很好,我看不到任何可能导致这种情况的因素。我试着把主面板放在另一个面板上作为底座,这没有什么区别 如果有任何机构有任何想法,我都欢迎听取。我想这已经到了我看不见树木的地步
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);
你有它应该是什么样子的模型吗?变量名不应该以大写字符开头。也许没有,但这对表单大小调整不正确没有任何影响