|
-
December 20th, 2011, 03:16 AM
#2
Re: Need help with buttons...
Laying out the components in a container is strictly married to the LayoutManager that is used. Frames contentpanes use BorderLayout by default, anything added to BorderLayout by calling single param add(Component component) is added to BorderLayout´s CENTER. If no other components are added, the single one will thus consume whole of the available space.
Use a LayoutManager that fits your purpose, check up on BoxLayout and FlowLayout.
Remember that you can use multiple LayoutManagers to construct wgat you want.
Remember that you can use transparent, non focusable components as fillers.
As a last resort, you can always override the getMaximumSize() and getMinimumSize() methods of a component. This you however should do, when there is ample reason to do so.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|