aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes getPrefferedSize setLayout(null) 0 0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getPrefferedSize setLayout(null) 0 0" Watch "getPrefferedSize setLayout(null) 0 0" New topic
Author

getPrefferedSize setLayout(null) 0 0

Oczek Oczkowy
Greenhorn

Joined: Nov 01, 2006
Posts: 12
hi,
i have problem when i set my Jpanel layout to null (Jpanel.setLayout(null)) and i add there some buttons or different stuff my jpanel.getprefferdSize return 0 and i can not see my buttons. Do anybody have idea how to repair that?


fak de sys
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Oczek Oczkowy:
hi,
i have problem when i set my Jpanel layout to null (Jpanel.setLayout(null)) and i add there some buttons or different stuff my jpanel.getprefferdSize return 0 and i can not see my buttons. Do anybody have idea how to repair that?


Well that's what you should expect when you set your container's layout manager to null. The easiest way to 'repair' it is to use an actual
layout manager.

If you want the layout manager to remain null, which I don't recommend, you have to manually do what layout managers do. This includes setting a preferred size for your container and the bounds (size and position) of your buttons.


bitguru blog
 
jQuery in Action, 2nd edition
 
subject: getPrefferedSize setLayout(null) 0 0