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
            Asked
            
        
        
            Active
            
        
            Viewed 247 times
        
    0
            
            
        
        Miloš Lukačka
        
- 842
 - 1
 - 11
 - 25
 
- 
                    1Which layout are you using? If you are using GridLayout then I highly recommend checking this (http://stackoverflow.com/questions/5937229/java-is-it-possible-to-have-two-components-on-the-same-side-with-gridlayout) out. Good luck. – Tdorno May 13 '13 at 16:02
 - 
                    1You may use a `JPanel` with `CardLayout`, see [How to Use CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) for almost your case. – Howard May 13 '13 at 16:04
 
1 Answers
5
            For many components in one space, use a CardLayout as see in this short example.
 
        Community
        
- 1
 - 1
 
        Andrew Thompson
        
- 168,117
 - 40
 - 217
 - 433