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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.