0

Helew!

I just wana know if someone might have an idea of how I can go about doing this:

So attached I have a little example I whiped up. Say you have 3 buttons, button1, button2, button3. What I wana do, is when you click button1, it will magicly turn into another button called button4.

Is this possible? How? What would I put in my button1's actionPerformed to create and display button4 in button1s place?

Thanks alot!

Attachments Demonstration.JPG 12.08 KB
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by javaAddict
0

You want that other "Button 4" to have a different functionality or simply change its label.
For changing label use the set methods of the JButton class API.

For changing the button, you can try to look at the API of JButton, if it has a setVisible method.
You can have both buttons placed at that location but one would be hidden. When you click the "1" you can hide that and make the "4" visible.
Like I said in order for that to work you need to look at the API. I am not sure if it can be done

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.