0

我有一个主面板,其中还有另一个面板,我正在向其应用滚动。该面板又包含 2 个面板。

现在,当我应用滚动时,会出现滚动条。

问题是当我从用户屏幕部分动态添加数据时......数据出现在屏幕上,但我无法向下滚动面板,并且无法正确看到滚动条下方的数据。

generalInformationPanel = new JPanel(new GridLayout(1, 1));
generalInformationPanel.setBounds(0, 0, 1050, 500);
generalInformationPanel.setBackground(Color.WHITE);

gd_GeneralInformationUpperPanel = new JPanel();
gd_GeneralInformationUpperPanel.setBounds(0, 0, 1050, 700);
gd_GeneralInformationUpperPanel.setLayout(null);
gd_GeneralInformationUpperPanel.setBackground(Color.WHITE);
js1 = new JScrollPane(gd_GeneralInformationUpperPanel,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
js1.setBounds(0, 0, 950, 450);
js1.setVisible(true);
generalInformationPanel.add(js1);

add(generalInformationPanel, BorderLayout.CENTER);
4

0 回答 0