There are no icons in JRadioButton. The user interface simply draws icons as needed, so you cannot use the getIcon ... () methods to get the icons and scale. Therefore, when you work around, you need to create your own icon image before you scale them.
Here you are to get you started. The Screen Image class makes it easy to create component images. Note that you will also need to create images for the rollover icons. This can be done by setting the ButtonModel.setRollover (true) method for both normal and selected switch state.
import java.awt.*; import java.awt.image.*; import javax.swing.*; import javax.swing.border.*; public class RadioButtonScale extends JFrame { private static void createAndShowGUI() { JPanel north = new JPanel(new FlowLayout(0, 0, FlowLayout.LEFT)); JRadioButton button = new JRadioButton("Radio Button"); north.add(button); JPanel south = new JPanel(); JLabel west = new JLabel(); west.setBorder(new LineBorder(Color.GREEN)); south.add(west, BorderLayout.WEST); JLabel east = new JLabel(); east.setBorder(new LineBorder(Color.GREEN)); south.add(east, BorderLayout.EAST);
source share