This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Now that i can add a component dynamically, i would like to also remove it when needed.
How would i go about this, currently this is what im doing in my actionPerformed method:
if the checkbox is checked add the graph to the panel, if unchecked remove it from the panel. The problem is im making the panel on the fly so i cant use .remove to get rid of it, or can I? Here is my attempt
[ September 07, 2006: Message edited by: john latham ]
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
a lot depends on where this is LineGraphGui l = new LineGraphGui("Node "+row, "Time", "Temperature");
if it is part of the method that adds, then remove(l) will not be referring to the previously added (l), but to the new (l) just created.
here's a simple demo using a checkbox to add/remove
john latham
Greenhorn
Joined: May 28, 2006
Posts: 22
posted
0
Hmm i see what you mean, but is it possible to add something i create as an anyonous class and remove it? Because i dont want to make a graph unless the user asks for it.