This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Custom Layout Manager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Custom Layout Manager" Watch "Custom Layout Manager" New topic
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 ]
 
jQuery in Action, 2nd edition
 
subject: Custom Layout Manager
 
Similar Threads
Placing a button anywhere
basic swing layout problem.
Help for making swing custom widget using Visual Editor
Custom painting/graphics
How to create a custom layout manager