我已将两个 JPanel 添加到JPanel
with 中GridBagLayout
。现在的问题是:
当主面板加载时,它会在实际位置上方显示上面板位,并且当来自 db 的数据加载到JTextfields
然后JComboBox
面板变为其实际大小时。
示例代码:
public class JPanelIssue extends JPanel {
public JPanelIssue() {
JPanel mainPanel = new JPanel(new GridBagLayout());
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
mainPanel.add(panel1, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.6, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
mainPanel.add(panel2, new GridBagConstraints(0, 1, 1, GridBagConstraints.REMAINDER, 1.0, 0.4,GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
add(mainPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
}
panel1
包含与搜索条件相关的字段并panel2
包含JTable
显示结果。
AWT 事件队列是否有任何问题或任何其他问题?
提前致谢。