Dynamic « JComponent « Java Swing Q&A





1. Adding a jComponent dynamically    coderanch.com

ok, i ive just done what you said and i have found some problems. When i try to add the LineGraphGui to the main panel(by pressing the button), nothing happens. And just as a test i tried adding the LineGraphGui before runtime to see if everything is ok, but it wasnt. It is appearing really small on the screen just like ...

2. Removing a JComponent Dynamically    coderanch.com

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 ...