1- i have 2 buttons, i want to add them to the same location, when i click on button1 then the button1 will hidden and show button2, when i click on button2 then
button2 will hidden and show button1 again? please help me to slove my problem.
2- I have one button, but in this button i want to add 2 images (image1 and image2), when start the program, it's will show default button with image1, i want to
when i click on this button then image1 will hidden and show image2 on the button, when i click obn this button again so image2 will hidden and image1 show again.\
thanks for you help
1) Why do you want to do that? What effect/functionality are you trying to achieve ?It is bad usability to show/hide/flip components on an existing UI. Are you aware, you can change the Icon/Text of a button any time?
2)Same as above. You can change the Icon of the button. Check out AbstractButton#setIcon(Icon icon) and AbstractButton#setSelectedIcon(Icon icon). You can subclass the JButton and maintain the state and flip icons accordingly. Also, if you want your button to "
stay pressed/toggled" check out JToggleButtton.
[ October 05, 2008: Message edited by: Maneesh Godbole ]