简体   繁体   中英

Layout labels from left to right

I would like some help on choosing or creating a layout for a component to which I will add labels at runtime. For example the component size will be 400*50 and empty when the application start up. Then some action will add a first label at position 0, the second at position first label's width, the third at first label's width + second label's width and so on. A bit like the FlowLayout except that I want my labels to start at the left of the container and not in the center. Thanks for helping.

Just use a FlowLayout and call setAlignment(FlowLayout.LEFT); (or use one of the constructors that takes an alignment code).

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