• Post Reply Bookmark Topic Watch Topic
  • New Topic

GUI panels invisible with BorderLayout but visible with FlowLayout  RSS feed

 
Aahan Agrawal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added three JPanels to a JFrame using the code block below, and the GUI did not display the panel referred to by the variable "hang."





When using a GridLayout, however, "hang" was displayed.



What gave rise to the difference? I understood that border layout would displace one panel if a second oner were positioned at the same location as first one.
This isn't the case here, though.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you applying BorderLayout constraints when adding to a container with a GridLayout?
 
Aahan Agrawal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant to write the following code. Sorry!

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!