Miloš Lukačka
Miloš Lukačka

Reputation: 842

Java swing - creating text field on button's place

When specific action is performed, I want to replace button with text field. I know that I have to call button1.setVisible(false); but I don't know how to create text field on the exact same place. I am using NetBeans designer, if you can give me a hint, how to add 2 components at same place, and switch between then, something like switching between layers in photoshop, if something like that is possible, would be great. Thanks

Upvotes: 0

Views: 252

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168815

For many components in one space, use a CardLayout as see in this short example.

Upvotes: 5

Related Questions