aspose file tools*
The moose likes Beginning Java and the fly likes Recreating Buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Recreating Buttons" Watch "Recreating Buttons" New topic
Author

Recreating Buttons

Donovan Brock
Greenhorn

Joined: Nov 01, 2006
Posts: 2
Hello,

Is it possible to remove a button from an already created pane and then to create a button in place of it, or could you replace a button by creating one on top of it?


Thank you.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Do you have to get rid of the button?

You can change the text of an existing button.
Lambert Stein
Greenhorn

Joined: Oct 30, 2006
Posts: 14
I do not know any reason for you to remove the button - but if you HAVE to hide it, there should be a Button.hide() or something (I'm kinda new to java).
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Yes, you can remove a component from the containment hierarchy. Yes, you can add a different button to the container as well. Whether or not that new button is in the same place as the old button is going to depend entirely on your layout and whether or not any state or constraints that are used by the layout are the same.

Example:



The two buttons happen to have a very similar size because the text is roughly the same size. If the buttons had vastly different sizes then obviously that would cause a problem since BorderLayout honors them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Recreating Buttons