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

public class MainPanel extends JPanel {
    protected static final Font FONT12 = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
    protected static final Font FONT24 = new Font(Font.SANS_SERIF, Font.PLAIN, 24);
    protected static final Font FONT32 = new Font(Font.SANS_SERIF, Font.PLAIN, 32);

    public MainPanel() {
        super(new BorderLayout());

        JToolBar toolbar = new JToolBar();
        toolbar.add(new AbstractAction("12") {
            @Override public void actionPerformed(ActionEvent e) {
                updateFont(FONT12);
            }
        });
        toolbar.add(new AbstractAction("24") {
            @Override public void actionPerformed(ActionEvent e) {
                updateFont(FONT24);
            }
        });
        toolbar.add(new AbstractAction("32") {
            @Override public void actionPerformed(ActionEvent e) {
                updateFont(FONT32);
            }
        });

        JLabel label = new JLabel("Test:");
        JComboBox<String> combo = new JComboBox<>(new String[] {"Test"});
        JButton button = new JButton("Dialog");
        button.addActionListener(e -> {
            Toolkit.getDefaultToolkit().beep();
            JComponent c = (JComponent) e.getSource();
            JOptionPane.showMessageDialog(c.getRootPane(), "MessageDialog", "Change All Font Size", JOptionPane.ERROR_MESSAGE);
        });

        GridBagConstraints c = new GridBagConstraints();
        JPanel panel = new JPanel(new GridBagLayout());

        c.weightx = 0d;
        c.insets = new Insets(5, 5, 5, 0);
        c.anchor = GridBagConstraints.LINE_START;
        panel.add(label, c);

        c.weightx = 1d;
        c.fill = GridBagConstraints.HORIZONTAL;
        panel.add(combo, c);

        c.weightx = 0d;
        c.insets = new Insets(5, 5, 5, 5);
        c.anchor = GridBagConstraints.LINE_END;
        panel.add(button, c);

        add(toolbar, BorderLayout.NORTH);
        add(panel);
        updateFont(FONT12);
        setPreferredSize(new Dimension(320, 240));
    }
    protected final void updateFont(Font font) {
        FontUIResource fontUIResource = new FontUIResource(font);
        for (Object o: UIManager.getLookAndFeelDefaults().keySet()) {
            if (o.toString().toLowerCase(Locale.ENGLISH).endsWith("font")) {
                UIManager.put(o, fontUIResource);
            }
        }
        recursiveUpdateUI(this); //SwingUtilities.updateComponentTreeUI(this);
        Container c = getTopLevelAncestor();
        if (c instanceof Window) {
            ((Window) c).pack();
        }
    }
    private static void recursiveUpdateUI(JComponent p) {
        for (Component c: p.getComponents()) {
            if (c instanceof JToolBar) {
                continue;
            } else if (c instanceof JComponent) {
                JComponent jc = (JComponent) c;
                jc.updateUI();
                if (jc.getComponentCount() > 0) {
                    recursiveUpdateUI(jc);
                }
            }
        }
    }
    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);
    }
}

@@ -151,22 +151,17 @@
 va.util.
-Locale
+*
 ;%0Aimport
@@ -573,345 +573,316 @@
  JTo
-olBar toolbar = new JToolBar();%0A        toolbar.add(new AbstractAction(%2212%22) %7B%0A            @Override public void actionPerformed(ActionEvent e) %7B%0A                updateFont(FONT12);%0A            %7D%0A        %7D);%0A        toolbar.add(new AbstractAction(%2224%22) %7B%0A            @Override public void actionPerformed(ActionEvent e) %7B%0A               
+ggleButton tgb12 = new JToggleButton(%2212%22);%0A        tgb12.addActionListener(e -%3E updateFont(FONT12));%0A%0A        JToggleButton tgb24 = new JToggleButton(%2224%22);%0A        tgb24.addActionListener(e -%3E updateFont(FONT24));%0A%0A        JToggleButton tgb32 = new JToggleButton(%2232%22);%0A        tgb32.addActionListener(e -%3E
  upd
@@ -897,21 +897,23 @@
 FONT
-24
+32)
 );%0A
+%0A
         
     
@@ -912,69 +912,152 @@
     
-    %7D%0A        %7D);%0A        toolbar.add(new AbstractAction(%2232%22
+JToolBar toolbar = new JToolBar();%0A        ButtonGroup bg = new ButtonGroup();%0A        for (AbstractButton b: Arrays.asList(tgb12, tgb24, tgb32)
 ) %7B%0A
@@ -1072,112 +1072,84 @@
     
-@Override public void actionPerformed(ActionEvent e) %7B%0A                updateFont(FONT32);%0A            %7D
+b.setFocusPainted(false);%0A            bg.add(b);%0A            toolbar.add(b);
 %0A   
@@ -1146,34 +1146,32 @@
 dd(b);%0A        %7D
-);
 %0A%0A        JLabel

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