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

Custom Layout Manager

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a custom layout manager that will stretch components horizontally while leaving the height the same. I'm having a problem implementing the minimumLayoutSize method. It seems that this method never gets called. Do I need to specifically call it? Thanks.
Kory
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Creating a Custom Layout Manager from Sun's Java Tutorial:


Dimension minimumLayoutSize(Container)

Called by the Container getMinimumSize method, which is itself called under a variety of circumstances...


But, you maybe already knew that.
 
Kory Spansel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, that makes sense. Let me be more specific I'm still having a problem. Let's say I have 5 buttons on a JPanel and that JPanel is inside a JFrame. When I resize the frame horizontally it will stop resizing at a certain width. Basically, what I need to know is what method is called to get the minimum width of the frame when the frame is resized. I've done some testing and nothing gets called when the frame resizes. I to set a minimum size for my JPanel so my components don't get screwed up. I was hoping I could do this from my LayoutManager.
Kory
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not terribly experienced at creating custom layout managers, but inexperience hasn't stopped me from making something up yet...
I understand what you mean. I don't know how the existing layout managers provide that behavior. Have you tried looking at the source code for one of the existing layout managers that has the behavior you want to use?
Otherwise, in a recent question I posted, Jeff Smith recommended considering implementing ComponentListener. Perhaps this will provide you with the functionality you desire.
Good Luck.
[ April 06, 2002: Message edited by: Dirk Schreckmann ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic