• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Don't automatically resize panel

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i have written an own layout manager for my use case. i have a panel with boxes, which can be moved through the panel, they can be ordered next to each other, above and below each other an in the corners. when a new box enters the field and it is to big, all existing boxes resizes themselves a bit, so that the new friend fits in the panel.

but i have a problem: java sets the size of the main panel on it's own.
for example: the height of the panel is 1000px (let's say that's the size of screen). when there is one box with 600px, everythings fine. when next to the box comes another box with also 600px, java resizes the panel to 1200px, although the two boxes are next to each other and the 200 additional pixels are not needed.

how can i tell java not to resize the mainpanel until the additional space is really needed?

thank you in advance
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The layout manager determines how large the panel should be, so I'd check your implementation for preferredLayoutSize. If two components will be located next to each other the height for the panel should be the max of the two component heights, not the sum.
 
M Bryan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that did it, than you
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
reply
    Bookmark Topic Watch Topic
  • New Topic