• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel within JPanel and updateUI  RSS feed

 
Mulyadi Kurniawan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!