This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with BorderLayout  RSS feed

 
Lys Marie Santana dos Santos Silva
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people!!

I was sutdying and I saw this code... I understand everything that the code do, but i don�t know what happens with the line in bold... It seems that "BorderLayout.CENTER" doesn�t work. Anyone could help me?? What is wrong at this code??



Thanks again for the help!!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a read of BorderLayout's api docs, for a more detailed explanation

Basically, BorderLayout works by allocating space in this order
North/South
West/East
and all space left over goes to CENTER.

in the example the only component in the BorderLayout is the panel 'LogoAnimator'
so it occupies 'all' of the space.

paintComponent() is coded to draw the icon at (0,0) so it will be
in the top left of the panel, which is effectively the top left of the frame.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!