Java Swing JLabel宽度问题
怪我咯
怪我咯 2017-04-17 17:58:12
0
1
436

我想让JLabel的宽度自适应,就是说文字有多长JLabel的宽度就多宽。
类似Android中wrap_content的效果。
应该如何实现呢?
望赐教!

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all (1)
刘奇

The problem is not with JLabel itself, but with the layout management you use. Because when there is only one object, JLabel, the difference cannot be seen. When you put JLabel and other objects together, the blank space in the middle will appear.

You can take a look at the tutorial here to learn: http://zetcode.com/tutorials/javaswingtutorial/swinglayoutmanagement/

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!