// -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@

package example;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.border.EmptyBorder;

public final class MainPanel extends JPanel {
  public MainPanel() {
    super(new BorderLayout());
    Box box = Box.createVerticalBox();
    box.add(makeLabel("asdfasdfas"));
    box.add(makeLabel("zxcvzxcvzxcvzxcvzxcvzxcvzxcv"));
    box.add(makeLabel("1235436873434325"));
    box.add(makeLabel("asdfasdfas"));
    box.add(makeLabel("qwerqwerqwerqwerqwerqwerqwewretwertwetrerqwerqw"));
    box.add(makeLabel("1235436873434325"));
    box.add(Box.createVerticalGlue());
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(new JScrollPane(box));
    setPreferredSize(new Dimension(320, 240));
  }

  private JLabel makeLabel(String str) {
    JLabel label = new JLabel(str);
    label.setBorder(new RippleBorder(label, 10));
    return label;
  }

  public static void main(String[] args) {
    EventQueue.invokeLater(MainPanel::createAndShowGui);
  }

  private static void createAndShowGui() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
      Toolkit.getDefaultToolkit().beep();
    }
    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 RippleBorder extends EmptyBorder {
  protected final Timer animator;
  private float count = 1f;

  protected RippleBorder(Component c, int width) {
    super(width, width, width, width);
    animator = new Timer(80, e -> {
      c.repaint();
      count += .9f;
    });
    c.addMouseListener(new MouseAdapter() {
      @Override public void mouseEntered(MouseEvent e) {
        e.getComponent().setForeground(Color.RED);
        animator.start();
      }

      @Override public void mouseExited(MouseEvent e) {
        e.getComponent().setForeground(Color.BLACK);
      }
    });
  }

  @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
    if (!animator.isRunning()) {
      super.paintBorder(c, g, x, y, w, h);
      return;
    }
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setPaint(Color.WHITE); // c.getBackground().brighter());
    float a = 1f / count;
    boolean shouldBeHidden = .12f - a > 1.0e-2;
    if (shouldBeHidden) {
      a = 0f;
    }
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, a));
    Insets i = getBorderInsets();
    int xx = i.left - (int) count;
    int yy = i.top - (int) count;
    int ww = i.left + i.right - (int) (count * 2f);
    int hh = i.top + i.bottom - (int) (count * 2f);
    g2.setStroke(new BasicStroke(count * 1.2f));
    g2.drawRoundRect(xx, yy, w - ww, h - hh, 10, 10);
    if (xx < 0 && animator.isRunning()) {
      count = 1f;
      animator.stop();
    }
    g2.dispose();
  }
}

@@ -294,21 +294,22 @@
 el %7B%0A  p
-ublic
+rivate
  MainPan
@@ -404,34 +404,35 @@
 (makeLabel(%22
-asdfasdfas
+00000000000
 %22));%0A    box
@@ -451,36 +451,35 @@
 el(%22
-zxcvzxcvzxcvzxcvzxcvzxcvzxcv
+111111111111111111111111111
 %22));
@@ -550,18 +550,16 @@
 el(%22
-asdfasdfas
+22222222
 %22));
@@ -586,55 +586,51 @@
 el(%22
-qwerqwerqwerqwerqwerqwerqwewretwertwetrerqwerqw
+3333333333333333333333333333333333333333333
 %22));
@@ -1841,21 +1841,20 @@
  c, int 
-width
+size
 ) %7B%0A    
@@ -1863,34 +1863,30 @@
 per(
-width, width, width, width
+size, size, size, size
 );%0A 

change the constructor from public to private