简体   繁体   English

JButton,图标下方有文字

[英]JButton with text below the icon

In Java Swing I would like to create a JButton which contains an image(icon) and some text. 在Java Swing中,我想创建一个包含图像(图标)和一些文本的JButton。 In few words a JButton(text,icon). 简言之,JButton(文字,图标)。 I would like the text to be displayed below the image, and not beside, as in normal JButton layout. 我希望文本显示在图像下方,而不是旁边,就像普通的JButton布局一样。 Does anyone have an idea on how to achieve this? 有没有人知道如何实现这一目标?

使用常量SwingConstants.BOTTOM 查看AstractButton中的方法setVerticalTextPosition。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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