posted 22 years ago
Hi,
I have a JPanel within a JPanel. Let's say JPanel A is within JPanel B. If I want to refresh A, should I refresh B too? If so, what is the order?
Below is some of my code. Is it the right way to refresh the JPanel?
Thank you.
Sincerely,
Mulyadi Kurniawan
=======
...
profitInfo = new JPanel();
profitInfo.setLayout(new FlowLayout());
profitInfo.add(tpInfo);
profitInfo.add(tpgInfo);
...
inputPane = new JPanel();
inputPane.setLayout(new BorderLayout());
inputPane.setBackground(Color.white);
inputPane.add(profitInfo, BorderLayout.NORTH);
...
public void actionPerformed(ActionEvent ae) {
...
profitInfo.remove(tpInfo);
profitInfo.remove(tpgInfo);
profitInfo.add(tpInfo);
profitInfo.add(tpgInfo);
profitInfo.updateUI();
inputPane.remove(profitInfo);
inputPane.add(profitInfo, BorderLayout.NORTH);
inputPane.updateUI();
...