-3

I want to have 9 JPanel components on a JFrame and have 4 JButton components on each panel. But after adding 9 panels, 8 of them disappear.

Anyone can help me to correct this?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
frnzkhnkhk
  • 13
  • 5
  • You'll have to be more specific, your description is so poor, we can't imagine if you want these panels one over each other, in different locations. Try to draw it on paint, upload the file and update your question with the image url since given your reputation you won't be able to upload it here. Just share the link. – Drumnbass May 15 '15 at 06:59
  • *"But after adding 9 panels, 8 of them disappear. .."* **General development tip:** If anything involves 'more than one', first get it working with **2.** Once that works, it should be easy to adapt it to ..9 or whatever the actual GUI needs. – Andrew Thompson May 15 '15 at 07:06

1 Answers1

3

JFrame uses a BorderLayout by default, you may wish to consider using a different ones, compounding them to achieve your desired results. See Laying Out Components Within a Container for more details.

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • 2
    *"..you may wish to consider using a different one"* Or, as we commonly do, use [**combinations** of layout managers](http://stackoverflow.com/a/5630271/418556) (or a `JTabbedPane`). – Andrew Thompson May 15 '15 at 07:04