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

package example;

import java.awt.*;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel;

public final class MainPanel extends JPanel {
  private final String[] columnNames = {"String", "Integer", "Boolean"};
  private final Object[][] data = {
    {"aaa", 12, true}, {"bbb", 5, false},
    {"CCC", 92, true}, {"DDD", 0, false}
  };
  private final TableModel model = new DefaultTableModel(data, columnNames) {
    @Override public Class<?> getColumnClass(int column) {
      return getValueAt(0, column).getClass();
    }
  };
  private final JTable table = new JTable(model) {
    private final Color evenColor = new Color(0xFA_FA_FA);
    @Override public Component prepareRenderer(TableCellRenderer tcr, int row, int column) {
      Component c = super.prepareRenderer(tcr, row, column);
      if (isCellSelected(row, column)) {
        c.setForeground(getSelectionForeground());
        c.setBackground(getSelectionBackground());
      } else {
        c.setForeground(getForeground());
        c.setBackground(row % 2 == 0 ? evenColor : getBackground());
      }
      return c;
    }
  };
  private final JScrollPane scrollPane = new JScrollPane(table);

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

    table.setAutoCreateRowSorter(true);

    // table.setTableHeader(null);
    // table.setTableHeader(new JTableHeader(table.getColumnModel()));

    add(scrollPane);
    JCheckBox check = new JCheckBox("JTableHeader visible: ", true);
    check.addActionListener(e -> {
      JCheckBox cb = (JCheckBox) e.getSource();
      // table.getTableHeader().setVisible(cb.isSelected());
      scrollPane.getColumnHeader().setVisible(cb.isSelected());
      scrollPane.revalidate();
    });
    add(check, BorderLayout.NORTH);
    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);
  }
}

@@ -317,21 +317,64 @@
 private 
-final
+MainPanel() %7B%0A    super(new BorderLayout());%0A   
  String%5B
@@ -425,29 +425,17 @@
 an%22%7D;%0A  
-private final
+ 
  Object%5B
@@ -447,16 +447,18 @@
 ata = %7B%0A
+  
     %7B%22aa
@@ -495,16 +495,18 @@
 e%7D,%0A    
+  
 %7B%22CCC%22, 
@@ -534,36 +534,26 @@
  false%7D%0A
+  
   %7D;%0A  
-private final
+ 
  TableMo
@@ -607,24 +607,26 @@
 ames) %7B%0A    
+  
 @Override pu
@@ -670,24 +670,26 @@
 mn) %7B%0A      
+ 
+ 
 return getVa
@@ -721,38 +721,30 @@
 ();%0A    
+  
 %7D%0A  
+ 
+ 
 %7D;%0A  
-private final
+ 
  JTable 
@@ -767,24 +767,26 @@
 le(model) %7B%0A
+  
     private 
@@ -832,24 +832,26 @@
 FA_FA);%0A    
+  
 @Override pu
@@ -923,24 +923,26 @@
 t column) %7B%0A
+  
       Compon
@@ -996,16 +996,18 @@
 ;%0A      
+  
 if (isCe
@@ -1033,32 +1033,34 @@
 umn)) %7B%0A        
+ 
+ 
 c.setForeground(
@@ -1078,32 +1078,34 @@
 nForeground());%0A
+  
         c.setBac
@@ -1145,16 +1145,18 @@
 ;%0A      
+ 
+ 
 %7D else %7B
@@ -1156,16 +1156,18 @@
  else %7B%0A
+  
         
@@ -1200,32 +1200,34 @@
 und());%0A        
+  
 c.setBackground(
@@ -1273,26 +1273,30 @@
 d());%0A      
-%7D%0A
+  %7D%0A  
       return
@@ -1307,135 +1307,18 @@
     
-%7D%0A
   %7D
-;
 %0A  
-private final JScrollPane scrollPane = new JScrollPane(table);%0A%0A  public MainPanel() %7B%0A    super(new BorderLayout());%0A
+  %7D;
 %0A   
@@ -1354,17 +1354,16 @@
 (true);%0A
-%0A
     // t
@@ -1461,16 +1461,69 @@
 l()));%0A%0A
+    JScrollPane scrollPane = new JScrollPane(table);%0A
     add(

change the constructor from public to private