简体   繁体   中英

What Exactly Does “Alignment.BASELINE” mean in a Java GroupLayout?

I'm learning about GroupLayout in Java.

Alignment.LEADING , CENTER , and TRAILING makes sense to me,

but I have no idea what BASELINE means.

Where do the components get positioned if I indicate Alignment.BASELINE ?

I know that this is a very basic question, but can anyone please help me?

Thanks in advance.

Alignment.BASELINE works for components which renders a textual information (eg JLabel, JButton, etc). With Alignment.BASELINE alignment, the GroupLayout will align such components so that the baseline of their text stays on the same (horizontal) line (makes for an easier reading, the eye doesn't need to jump up/down on the virtual line of text).

See Java Swing tutorial - GroupLayout - specifically the 'Vertical Layout' section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM