Reputation: 885
I'm new to Java GUI.
First I created a JFrame and have added a JPanel. After that I set it as a Null Layout. Then added a label and set a background image for the frame. For my project I need to add separate 4 JPanels for this JFrame. On those JPanels I'm going to add Labels and Text boxes. I want to know whether it's correct or not to add 4 JPanels on a main JPanel?
Upvotes: 1
Views: 523
Reputation: 168825
I want to know whether it's correct or not to add 4 JPanels on a main JPanel?
Sure. Most of the Java GUIs you see that are any more than trivial put panels inside other panels.
Sometimes a different panel is used to group common controls or output components and possibly give them a titled border. More commonly different panels are used in order to use different layout managers in separate parts of the GUI. Here is a well known example that puts the details of the layout in a titled border for the panel..
Upvotes: 3