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

public final class MainPanel extends JPanel {
    private MainPanel() {
        super(new GridLayout(1, 3));
        ButtonGroup bg = new ButtonGroup();

        Box box0 = Box.createVerticalBox();
        box0.setBorder(BorderFactory.createTitledBorder("Default"));
        int i = 0;
        while (i < 4) {
            JRadioButton b = new JRadioButton("Default: " + i);
            bg.add(b);
            box0.add(b);
            b.setAlignmentX(Component.LEFT_ALIGNMENT);
            box0.add(Box.createVerticalStrut(5));
            i++;
        }

        Box box1 = Box.createVerticalBox();
        box1.setBorder(BorderFactory.createTitledBorder("Text Color"));
        while (i < 8) {
            JRadioButton b = new ColorRadioButton("Text: " + i);
            bg.add(b);
            box1.add(b);
            box1.add(Box.createVerticalStrut(5));
            i++;
        }

        Box box2 = Box.createVerticalBox();
        box2.setBorder(BorderFactory.createTitledBorder("Icon Color"));
        while (i < 12) {
            JRadioButton b = new ColorRadioButton("Icon: " + i) {
                @Override public void updateUI() {
                    super.updateUI();
                    setIcon(new DefaultIcon());
                    setPressedIcon(new PressedIcon());
                    setSelectedIcon(new SelectedIcon());
                    setRolloverIcon(new RolloverIcon());
                }
            };
            bg.add(b);
            box2.add(b);
            box2.add(Box.createVerticalStrut(5));
            i++;
        }

        add(box0);
        add(box1);
        add(box2);
        setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        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 ColorRadioButton extends JRadioButton {
    protected ColorRadioButton(String text) {
        super(text);
    }
    @Override public void updateUI() {
        super.updateUI();
        setForeground(DefaultIcon.DEFAULT_COLOR);
        setAlignmentX(Component.LEFT_ALIGNMENT);
    }
    @Override protected void fireStateChanged() {
        ButtonModel model = getModel();
        if (model.isEnabled()) {
            if (model.isPressed() && model.isArmed()) {
                setForeground(DefaultIcon.PRESSED_COLOR);
            } else if (model.isSelected()) {
                setForeground(DefaultIcon.SELECTED_COLOR);
            } else if (isRolloverEnabled() && model.isRollover()) {
                setForeground(DefaultIcon.ROLLOVER_COLOR);
            } else {
                setForeground(DefaultIcon.DEFAULT_COLOR);
            }
        } else {
            setForeground(Color.GRAY);
        }
        super.fireStateChanged();
    }
}

class DefaultIcon implements Icon {
    protected static final Color DEFAULT_COLOR  = Color.BLACK;
    protected static final Color PRESSED_COLOR  = Color.GREEN;
    protected static final Color SELECTED_COLOR = Color.RED;
    protected static final Color ROLLOVER_COLOR = Color.BLUE;
    protected static final int ICON_SIZE = 16;
    @Override public void paintIcon(Component c, Graphics g, int x, int y) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.translate(x, y);
        g2.setPaint(DEFAULT_COLOR);
        g2.drawRect(0, 0, getIconWidth() - 1,     getIconHeight() - 1);
        g2.drawRect(1, 1, getIconWidth() - 2 - 1, getIconHeight() - 2 - 1);
        g2.dispose();
    }
    @Override public int getIconWidth() {
        return ICON_SIZE * 2;
    }
    @Override public int getIconHeight() {
        return ICON_SIZE;
    }
}

class PressedIcon extends DefaultIcon {
    @Override public void paintIcon(Component c, Graphics g, int x, int y) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.translate(x, y);
        g2.setPaint(PRESSED_COLOR);
        g2.drawRect(0, 0, getIconWidth() - 1,     getIconHeight() - 1);
        g2.drawRect(1, 1, getIconWidth() - 2 - 1, getIconHeight() - 2 - 1);

        g2.setPaint(SELECTED_COLOR);
        g2.fillRect(4, 4, getIconWidth() - 8, getIconHeight() - 8);
        g2.dispose();
    }
}

class SelectedIcon extends DefaultIcon {
    @Override public void paintIcon(Component c, Graphics g, int x, int y) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.translate(x, y);
        g2.setPaint(SELECTED_COLOR);
        g2.drawRect(0, 0, getIconWidth() - 1,     getIconHeight() - 1);
        g2.drawRect(1, 1, getIconWidth() - 2 - 1, getIconHeight() - 2 - 1);

        g2.setPaint(PRESSED_COLOR);
        g2.fillRect(6, 6, getIconWidth() - 12, getIconHeight() - 12);
        g2.dispose();
    }
}

class RolloverIcon extends DefaultIcon {
    @Override public void paintIcon(Component c, Graphics g, int x, int y) {
        Graphics2D g2 = (Graphics2D) g.create();
        g2.translate(x, y);
        g2.setPaint(ROLLOVER_COLOR);
        g2.drawRect(0, 0, getIconWidth() - 1,     getIconHeight() - 1);
        g2.drawRect(1, 1, getIconWidth() - 2 - 1, getIconHeight() - 2 - 1);
        g2.dispose();
    }
}

@@ -109,16 +109,51 @@
 .awt.*;%0A
+import java.util.stream.IntStream;%0A
 import j
@@ -166,16 +166,16 @@
 wing.*;%0A
-
 %0Apublic 
@@ -446,40 +446,42 @@
     
-int i = 0;%0A        while (i %3C 4)
+IntStream.range(0, 4).forEach(i -%3E
  %7B%0A 
@@ -704,34 +704,19 @@
         
-    i++;%0A        %7D
+%7D);
 %0A%0A      
@@ -837,21 +837,42 @@
     
-while (i %3C 8)
+IntStream.range(4, 8).forEach(i -%3E
  %7B%0A 
@@ -1041,34 +1041,19 @@
         
-    i++;%0A        %7D
+%7D);
 %0A%0A      
@@ -1174,22 +1174,43 @@
     
-while (i %3C 12)
+IntStream.range(8, 12).forEach(i -%3E
  %7B%0A 
@@ -1715,25 +1715,8 @@
 ));%0A
-            i++;%0A
     
@@ -1720,16 +1720,18 @@
        %7D
+);
 %0A%0A      

use IntStream.range(...) instead of while (...)