This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data 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: 865
    
    1
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
 
Don't get me started about those stupid light bulbs.
 
subject: getPrefferedSize setLayout(null) 0 0