Can some one show me the code for a SIMPLE swing application window. were there are few components includign a button. Now on clicking the button i want to change the components on the window.I dont want old components i want new components.
Lets take an example
initially the window will have
Component - 1: a non editable JTextPane with a long string
Component - 2: a button that will convert entire string in JTextPane to uppercase and display
Component - 3: another button that will remove component -1 and Component-2 and show the length of the String as a label component (component) on the same window.
Its just like while installing an application we keep pressign "next" and we keep having different components on the window.Is it possible to have all the companents removed and just shows a message.
Please make it as simple and basic as possible without complications.I would be thankfull to all who help and contribute.
I understand the use of cardlayout. But just being inquisitive is it possible to change the appearance of the same Frame by changing the components it has. I dont mean chaging the properties of compnents but changing the components as just described in the example i took.
I tried removing a component from JFrame using remove(Component c) method but the system hanged. i think there was a deadlock. So i just thought if its possible or not
posted 10 years ago
I mean can i tell my actionPerformed() method to remove a few components from the JFrame like this.