JRadioButton:如何用IconImage替换文本? [英] JRadioButton: how to replace text by IconImage?

查看:238
本文介绍了JRadioButton:如何用IconImage替换文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一个图标替换单选按钮列表中的文本。

I want to replace the text in my radio button list by an icon.

我试过这个:

rotateButton = new JRadioButton(rotateIcon.getImage());

但这会用图标替换单选按钮和文本。我想保留单选按钮并显示图像。

But this replaces the radio button and text by the icon. I would like to keep the radio button and display the image.

我该怎么办?

我目前得到的是:

但我希望它最终得到:

推荐答案

公共JRadioButton(字符串文本,图标图标)和简单示例此处

这篇关于JRadioButton:如何用IconImage替换文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆