Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deleting/removing JPanel  RSS feed

 
oooo cccc
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a mortgage caculator that calculates a monthly mortgage payment and displays the mortgage's amortization table(when/if the user presses the table button). I also have a clear button that clears all the fields and removes the JPanel that my JTable is on.

My problem is this. When I click the Clear button, The JPanel is removed with the following code(it does what i want it to do):


getContentPane().remove(amortTablePanel);
getContentPane().repaint();



My problem is that when i calculate another mortgage and click the Amortization Table button, both the first and the second tables show up.

How can I completely remove the table when i click the Clear button?

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getContentPane().remove(amortTablePanel);
getContentPane().validate();//<--------should do it
getContentPane().repaint();

but why do you need to remove the table/panel?

clear the table, then reset the tableModel, would be much simpler
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!