| Author |
Custom Layout Manager
|
Kory Spansel
Greenhorn
Joined: Mar 05, 2002
Posts: 6
|
|
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
Joined: Dec 10, 2001
Posts: 7023
|
|
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.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Kory Spansel
Greenhorn
Joined: Mar 05, 2002
Posts: 6
|
|
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
Joined: Dec 10, 2001
Posts: 7023
|
|
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 ]
|
 |
 |
|
|
subject: Custom Layout Manager
|
|
|