GetHeight () vs getPreferredHeight () what's the difference

I know this is the question. but I can't figure out what is the difference between getHeight () and getPreferredHeight ()?

When do I need to use getHeight and when do getPreferredHeight?

: (

+2


a source to share


1 answer


Of course, getHeight

will get the actual height, but getPreferredHeight

will get the preferred height, no? :-)




In fact, upon further investigation, it appears getPreferredHeight

used by the layout manager, so you can tell at what height you want the controls to be.

getHeight

returns the actual height, which can apparently change if required.

+2


a source







All Articles