I have MainFrame which contains a lot of buttons, filled text areas and by clicking a button a want to go to other frame (NewFrame1) which will have the same look, elements etc. as MainFrame. Do I need to copy all stuff or is there other way to do that?
            Asked
            
        
        
            Active
            
        
            Viewed 28 times
        
    0
            
            
        - 
                    2Create a base class, probably which extends from `JPanel` which contains the basic UI elements you want to use. Show as many instances of this on as many containers as you want – MadProgrammer Jan 17 '17 at 20:58
- 
                    `Component` and its subclasses (ie everything in AWT and Swing) can only have 1 parent. So if you want to have the same look, you need to create a copy of everything – ControlAltDel Jan 17 '17 at 21:03
- 
                    By "copy" do you mean the data or the code? – MadProgrammer Jan 17 '17 at 21:04
- 
                    Can't you just create two instances of the same class? – Vinicius Victor Jan 17 '17 at 21:22
- 
                    1) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 2) See [What is the XY problem?](http://meta.stackexchange.com/q/66377) – Andrew Thompson Jan 18 '17 at 00:38
