This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why does the FlowLayoutManager layout more space than needed?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple first applet I'm playing with. I defined a Panel to go in the NORTH area of the main Panel and placed a single TextField in the Panel.

For some reason the FlowLayoutManager lays out enough space for 2 rows of TextFields in the Panel? Why is that? Is there a way to make it stop doing that?
 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example of code?
 
David M Fairchild
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add these 2 lines and you'll see where you need to look

pnlStatus.setBackground(Color.CYAN);
pnlGame.setBackground(Color.BLUE);
 
David M Fairchild
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see where the problem is not in the layout of the status panel. It appears that setBackground() does not set the color of the entire canvas. I would say that my "TheGame" class derived from Canvas is reserving space for a title bar. Although the bounds of cnvGame, an instance of TheGame include the whole canvas. The status text displays "Canvas bounds = 0, 33, 400, 334.". My applet is in a 400 by 400 space on the web page so 400 - 33 - 33 = 334, the full height minus the NORTH and SOUTH panels.

Now I'm looking for why Canvas is allocating space for a title bar and how I can turn that "feature" off.

Thanks for you help. Any additional insights would be helpful.
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic