package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.Arrays;
import java.util.List;
import javax.swing.*;

public final class MainPanel extends JPanel {
    private MainPanel() {
        super(new BorderLayout());

        //http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons
        ImageIcon nicon  = new ImageIcon(getClass().getResource("wi0063-32.png"));
        ImageProducer ip = new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter());
        ImageIcon sicon  = new ImageIcon(createImage(ip));
        JToggleButton t1 = new JToggleButton(nicon);
        JToggleButton t2 = new JToggleButton(nicon);
        t1.setSelectedIcon(sicon);
        t2.setSelectedIcon(sicon);
        List<? extends AbstractButton> l = Arrays.asList(new JRadioButton("RadioButton1"), new JRadioButton("RadioButton2"), t1, t2);

        ButtonGroup bg = new ButtonGroup();
        JPanel p = new JPanel(new GridLayout(2, 2));
        p.setBorder(BorderFactory.createTitledBorder("ButtonGroup"));
        for (AbstractButton b: l) {
            bg.add(b);
            p.add(b);
        }
        t2.setSelected(true);

        add(p, BorderLayout.NORTH);
        add(new JButton(new AbstractAction("clearSelection") {
            @Override public void actionPerformed(ActionEvent e) {
                bg.clearSelection();
            }
        }), BorderLayout.SOUTH);
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        setPreferredSize(new Dimension(320, 240));
    }

    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                createAndShowGUI();
            }
        });
    }
    public static void createAndShowGUI() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException
               | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        }
        JFrame frame = new JFrame("@title@");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

class SelectedImageFilter extends RGBImageFilter {
    //public SelectedImageFilter() {
    //    canFilterIndexColorModel = false;
    //}
    @Override public int filterRGB(int x, int y, int argb) {
        //Color color = new Color(argb, true);
        //float[] a = new float[4];
        //color.getComponents(a);
        //return new Color(a[0], a[1], a[2] * .5f, a[3]).getRGB();
        return (argb & 0xFFFFFF00) | ((argb & 0xFF) >> 1);
    }
}

@@ -1299,76 +1299,33 @@
     
-add(p, BorderLayout.NORTH);%0A        add(new JButton(new AbstractActi
+JButton clear = new JButt
 on(%22
@@ -1340,30 +1340,26 @@
 ection%22)
- %7B%0A   
+;%0A
         
  @Overri
@@ -1354,79 +1354,36 @@
     
- @Override public void actionPerformed(ActionEvent e) %7B%0A               
+clear.addActionListener(e -%3E
  bg.
@@ -1398,17 +1398,19 @@
 ection()
-;
+);%0A
 %0A       
@@ -1410,32 +1410,61 @@
         
-    %7D%0A        %7D)
+add(p, BorderLayout.NORTH);%0A        add(clear
 , Border

use a lambda expression instead of an anonymous class(ActionListener)