<commit_before>package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.table.*;

public final class MainPanel extends JPanel {
    private MainPanel() {
        super(new BorderLayout());

        // http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
        String[] columnNames = {"SNo.", "1", "2", "Native", "2", "3"};
        Object[][] data = {
            {"119", "foo", "bar", "ja", "ko", "zh"},
            {"911", "bar", "foo", "en", "fr", "pt"}
        };
        DefaultTableModel model = new DefaultTableModel(data, columnNames);
        JTable table = new JTable(model) {
            @Override protected JTableHeader createDefaultTableHeader() {
                TableColumnModel cm = getColumnModel();
                ColumnGroup gname = new ColumnGroup("Name");
                gname.add(cm.getColumn(1));
                gname.add(cm.getColumn(2));

                ColumnGroup glang = new ColumnGroup("Language");
                glang.add(cm.getColumn(3));

                ColumnGroup gother = new ColumnGroup("Others");
                gother.add(cm.getColumn(4));
                gother.add(cm.getColumn(5));

                glang.add(gother);

                GroupableTableHeader header = new GroupableTableHeader(cm);
                header.addColumnGroup(gname);
                header.addColumnGroup(glang);
                return header;
            }
        };
        add(new JScrollPane(table));
        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);
    }
}

/** GroupableTableHeader
 * http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
 * @version 1.0 10/20/98
 * @author <NAME>
 * modified by aterai <EMAIL>
 */
class GroupableTableHeader extends JTableHeader {
    private transient List<ColumnGroup> columnGroups;

    protected GroupableTableHeader(TableColumnModel model) {
        super(model);
    }
    @Override public void updateUI() {
        super.updateUI();
        setUI(new GroupableTableHeaderUI());
    }
//     @Override public boolean getReorderingAllowed() {
//         return false;
//     }
    @Override public void setReorderingAllowed(boolean b) {
        super.setReorderingAllowed(false);
    }
    public void addColumnGroup(ColumnGroup g) {
        if (columnGroups == null) {
            columnGroups = new ArrayList<>();
        }
        columnGroups.add(g);
    }
    public List<?> getColumnGroups(TableColumn col) {
        if (columnGroups == null) {
            return Collections.emptyList();
        }
        for (ColumnGroup cGroup: columnGroups) {
            List<?> groups = cGroup.getColumnGroupList(col, new ArrayList<Object>());
            if (!groups.isEmpty()) {
                return groups;
            }
        }
        return Collections.emptyList();
    }
}
<commit_msg>fix: override JTableHeader#getReorderingAllowed() method to return false<commit_after>package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.table.*;

public final class MainPanel extends JPanel {
    private MainPanel() {
        super(new BorderLayout());

        // http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
        String[] columnNames = {"SNo.", "1", "2", "Native", "2", "3"};
        Object[][] data = {
            {"119", "foo", "bar", "ja", "ko", "zh"},
            {"911", "bar", "foo", "en", "fr", "pt"}
        };
        DefaultTableModel model = new DefaultTableModel(data, columnNames);
        JTable table = new JTable(model) {
            @Override protected JTableHeader createDefaultTableHeader() {
                TableColumnModel cm = getColumnModel();
                ColumnGroup gname = new ColumnGroup("Name");
                gname.add(cm.getColumn(1));
                gname.add(cm.getColumn(2));

                ColumnGroup glang = new ColumnGroup("Language");
                glang.add(cm.getColumn(3));

                ColumnGroup gother = new ColumnGroup("Others");
                gother.add(cm.getColumn(4));
                gother.add(cm.getColumn(5));

                glang.add(gother);

                GroupableTableHeader header = new GroupableTableHeader(cm);
                header.addColumnGroup(gname);
                header.addColumnGroup(glang);
                return header;
            }
        };
        add(new JScrollPane(table));
        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);
    }
}

/** GroupableTableHeader
 * http://www2.gol.com/users/tame/swing/examples/JTableExamples1.html
 * @version 1.0 10/20/98
 * @author <NAME>
 * modified by aterai <EMAIL>
 */
class GroupableTableHeader extends JTableHeader {
    private transient List<ColumnGroup> columnGroups;

    protected GroupableTableHeader(TableColumnModel model) {
        super(model);
    }
    @Override public void updateUI() {
        super.updateUI();
        setUI(new GroupableTableHeaderUI());
    }
    // [java] BooleanGetMethodName: Don't report bad method names on @Override #97
    // https://github.com/pmd/pmd/pull/97
    @Override public boolean getReorderingAllowed() {
        return false;
    }
    @Override public void setReorderingAllowed(boolean b) {
        super.setReorderingAllowed(false);
    }
    public void addColumnGroup(ColumnGroup g) {
        if (columnGroups == null) {
            columnGroups = new ArrayList<>();
        }
        columnGroups.add(g);
    }
    public List<?> getColumnGroups(TableColumn col) {
        if (columnGroups == null) {
            return Collections.emptyList();
        }
        for (ColumnGroup cGroup: columnGroups) {
            List<?> groups = cGroup.getColumnGroupList(col, new ArrayList<Object>());
            if (!groups.isEmpty()) {
                return groups;
            }
        }
        return Collections.emptyList();
    }
}

{'fraction_non_alphanumeric': 0.1270725224655107, 'fraction_numerical': 0.009365903050246805, 'mean_word_length': 2.262592898431049, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7145209', 'n_tokens_mistral': 2253, 'n_tokens_neox': 2165, 'n_words': 447}