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

package example;

import java.awt.*;
import java.awt.event.ActionListener;
import java.util.stream.Stream;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel;

public class MainPanel extends JPanel {
  private static final String TEXT = "drag select table cells 1 22 333 4444 55555 666666 7777777 88888888";
  private final String[] columnNames = {"html"};
  private final Object[][] data = {
    {"<html><font color=red>font color red</font><br /> " + TEXT},
    {"<html><font color=green>font color green</font> " + TEXT},
    {"<html><font color=blue>font color blue</font> " + TEXT},
    {"<html><font color=black>font color black</font><br />  " + TEXT},
    {"<html><font color=orange>font color orange</font> " + TEXT},
    {"<html><font color=gray>font color gray</font> " + TEXT}
  };
  private final TableModel model = new DefaultTableModel(data, columnNames) {
    @Override public Class<?> getColumnClass(int column) {
      return String.class;
    }

    @Override public boolean isCellEditable(int row, int column) {
      return false;
    }
  };
  private final JTable table = new JTable(model);
  private final JRadioButton centerRadio = new JRadioButton("CENTER", true);
  private final JRadioButton topRadio = new JRadioButton("TOP");
  private final JRadioButton bottomRadio = new JRadioButton("BOTTOM");

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

    table.setAutoCreateRowSorter(true);
    table.setRowHeight(16);

    ActionListener al = e -> {
      TableCellRenderer r = table.getDefaultRenderer(String.class);
      if (r instanceof JLabel) {
        JLabel label = (JLabel) r;
        if (topRadio.isSelected()) {
          label.setVerticalAlignment(SwingConstants.TOP);
        } else if (bottomRadio.isSelected()) {
          label.setVerticalAlignment(SwingConstants.BOTTOM);
        } else {
          label.setVerticalAlignment(SwingConstants.CENTER);
        }
        table.repaint();
      }
    };
    ButtonGroup bg = new ButtonGroup();
    JPanel p = new JPanel();
    Stream.of(centerRadio, topRadio, bottomRadio).forEach(b -> {
      b.addActionListener(al);
      bg.add(b);
      p.add(b);
    });

    add(new JScrollPane(table));
    add(p, BorderLayout.SOUTH);
    setPreferredSize(new Dimension(320, 240));
  }

  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);
  }
}

@@ -338,16 +338,22 @@
 %0Apublic 
+final 
 class Ma
@@ -485,16 +485,17 @@
 88888%22;%0A
+%0A
   privat
@@ -496,21 +496,64 @@
 private 
-final
+MainPanel() %7B%0A    super(new BorderLayout());%0A   
  String%5B
@@ -580,29 +580,17 @@
 ml%22%7D;%0A  
-private final
+ 
  Object%5B
@@ -602,16 +602,18 @@
 ata = %7B%0A
+  
     %7B%22%3Ch
@@ -663,32 +663,34 @@
 r /%3E %22 + TEXT%7D,%0A
+  
     %7B%22%3Chtml%3E%3Cfon
@@ -734,32 +734,34 @@
  %22 + TEXT%7D,%0A    
+  
 %7B%22%3Chtml%3E%3Cfont co
@@ -795,32 +795,34 @@
 ont%3E %22 + TEXT%7D,%0A
+  
     %7B%22%3Chtml%3E%3Cfon
@@ -873,32 +873,34 @@
  %22 + TEXT%7D,%0A    
+ 
+ 
 %7B%22%3Chtml%3E%3Cfont co
@@ -946,24 +946,26 @@
  TEXT%7D,%0A    
+  
 %7B%22%3Chtml%3E%3Cfon
@@ -1010,36 +1010,26 @@
 + TEXT%7D%0A
+  
   %7D;%0A  
-private final
+ 
  TableMo
@@ -1083,24 +1083,26 @@
 ames) %7B%0A    
+  
 @Override pu
@@ -1136,32 +1136,34 @@
 s(int column) %7B%0A
+  
       return Str
@@ -1177,19 +1177,23 @@
 ss;%0A    
+  
 %7D%0A%0A
+  
     @Ove
@@ -1253,24 +1253,26 @@
 mn) %7B%0A      
+ 
+ 
 return false
@@ -1281,30 +1281,22 @@
     
-%7D%0A
+  %7D%0A  
   %7D;%0A  
-private final
+ 
  JTa
@@ -1324,37 +1324,94 @@
 e(model);%0A  
-private final
+  table.setAutoCreateRowSorter(true);%0A    table.setRowHeight(16);%0A%0A   
  JRadioButto
@@ -1458,37 +1458,25 @@
 %22, true);%0A  
-private final
+ 
  JRadioButto
@@ -1519,21 +1519,9 @@
 ;%0A  
-private final
+ 
  JRa
@@ -1576,133 +1576,8 @@
 %22);%0A
-%0A  public MainPanel() %7B%0A    super(new BorderLayout());%0A%0A    table.setAutoCreateRowSorter(true);%0A    table.setRowHeight(16);%0A%0A
     

change the constructor from public to private