• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom Layout Manager

 
Kory Spansel
Greenhorn
Posts: 6
  • 0
  • 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
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic