是否有可能调整文本和图像上方的一个JRadioButton
图标?
Is it possible to align both the text and image above the JRadioButton
icon?
修改 -
那么,显然设置的图标在构造其实是将默认的一个JRadioButton
图标,这是我没想到。看起来像我可能要使用两个单独的组件,并把它们放入同一容器中。
Edit -
Well, apparently setting the icon in the constructor actually replaces the default JRadioButton
icon, which I wasn't expecting. Looks like I may have to use two separate components and throw them into the same container.
这将设置上面的一个JRadioButton的文字:
This will set the text above the JRadioButton:
radiobutton.setHorizontalTextPosition(SwingConstants.CENTER);
radiobutton.setVerticalTextPosition(JRadioButton.TOP);
是的,使用方法的setIcon替换一个JRadioButton图标。
And yes, using the setIcon method replaces the JRadioButton icon.