<commit_before>package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI;

public class MainPanel extends JPanel{
    private static enum TabPlacements {
        TOP(JTabbedPane.TOP), BOTTOM(JTabbedPane.BOTTOM), LEFT(JTabbedPane.LEFT), RIGHT(JTabbedPane.RIGHT);
        public final int tabPlacement;
        private TabPlacements(int tabPlacement) {
            this.tabPlacement = tabPlacement;
        }
    }
    private final JComboBox<TabPlacements> comboBox = new JComboBox<>(TabPlacements.values());
    private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);

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

        comboBox.addItemListener(new ItemListener() {
            @Override public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange()==ItemEvent.SELECTED) {
                    tabbedPane.setTabPlacement(((TabPlacements)e.getItem()).tabPlacement);
                }
            }
        });
        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalGlue());
        box.add(new JLabel("TabPlacement: "));
        box.add(Box.createHorizontalStrut(2));
        box.add(comboBox);
        box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        if(tabbedPane.getUI() instanceof WindowsTabbedPaneUI) {
            tabbedPane.setUI(new WindowsTabbedPaneUI() {
                private final int tabAreaHeight = 32;
                @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
                    return tabAreaHeight; //super.calculateTabHeight(tabPlacement, tabIndex, fontHeight) + 4;
                }
                //@Override public Rectangle getTabBounds(JTabbedPane pane, int i) {
                //    Rectangle tabRect = super.getTabBounds(pane, i);
                //    tabRect.translate(0, -16);
                //    tabRect.height = 16;
                //    return tabRect;
                //}
                @Override protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) {
                    if(tabPane.getSelectedIndex()!=tabIndex && tabPlacement!=JTabbedPane.LEFT && tabPlacement!=JTabbedPane.RIGHT) {
                        int tabHeight = tabAreaHeight/2 + 3;
                        rects[tabIndex].height = tabHeight;
                        if(tabPlacement==JTabbedPane.TOP) {
                            rects[tabIndex].y = tabAreaHeight - tabHeight + 3;
                        }
                    }
                    super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
                }
            });
        }else{
            //t.setUI(new javax.swing.plaf.metal.MetalTabbedPaneUI() {
            tabbedPane.setUI(new BasicTabbedPaneUI() {
                private final int tabAreaHeight = 32;
                @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
                    return tabAreaHeight;
                }
                @Override protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) {
                    if(tabPane.getSelectedIndex()!=tabIndex && tabPlacement!=JTabbedPane.LEFT && tabPlacement!=JTabbedPane.RIGHT) {
                        int tabHeight = tabAreaHeight/2 + 3;
                        rects[tabIndex].height = tabHeight;
                        if(tabPlacement==JTabbedPane.TOP) {
                            rects[tabIndex].y = tabAreaHeight - tabHeight + 3;
                        }
                    }
                    super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
                }
            });
        }
        tabbedPane.addTab("00000", new JLabel("aaaaaaaaaaa"));
        tabbedPane.addTab("111112", new JLabel("bbbbbbbbbbbbbbbb"));
        tabbedPane.addTab("22222232", new JScrollPane(new JTree()));
        tabbedPane.addTab("3333333333", new JSplitPane());
        add(tabbedPane);
        add(box, BorderLayout.SOUTH);
        setPreferredSize(new Dimension(320, 240));<commit_msg>FindBugs: SS_SHOULD_BE_STATIC<commit_after>package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI;

public class MainPanel extends JPanel{
    private static enum TabPlacements {
        TOP(JTabbedPane.TOP), BOTTOM(JTabbedPane.BOTTOM), LEFT(JTabbedPane.LEFT), RIGHT(JTabbedPane.RIGHT);
        public final int tabPlacement;
        private TabPlacements(int tabPlacement) {
            this.tabPlacement = tabPlacement;
        }
    }
    private final JComboBox<TabPlacements> comboBox = new JComboBox<>(TabPlacements.values());
    private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);

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

        comboBox.addItemListener(new ItemListener() {
            @Override public void itemStateChanged(ItemEvent e) {
                if(e.getStateChange()==ItemEvent.SELECTED) {
                    tabbedPane.setTabPlacement(((TabPlacements)e.getItem()).tabPlacement);
                }
            }
        });
        Box box = Box.createHorizontalBox();
        box.add(Box.createHorizontalGlue());
        box.add(new JLabel("TabPlacement: "));
        box.add(Box.createHorizontalStrut(2));
        box.add(comboBox);
        box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        if(tabbedPane.getUI() instanceof WindowsTabbedPaneUI) {
            tabbedPane.setUI(new WindowsTabbedPaneUI() {
                private static final int tabAreaHeight = 32;
                @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
                    return tabAreaHeight; //super.calculateTabHeight(tabPlacement, tabIndex, fontHeight) + 4;
                }
                //@Override public Rectangle getTabBounds(JTabbedPane pane, int i) {
                //    Rectangle tabRect = super.getTabBounds(pane, i);
                //    tabRect.translate(0, -16);
                //    tabRect.height = 16;
                //    return tabRect;
                //}
                @Override protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) {
                    if(tabPane.getSelectedIndex()!=tabIndex && tabPlacement!=JTabbedPane.LEFT && tabPlacement!=JTabbedPane.RIGHT) {
                        int tabHeight = tabAreaHeight/2 + 3;
                        rects[tabIndex].height = tabHeight;
                        if(tabPlacement==JTabbedPane.TOP) {
                            rects[tabIndex].y = tabAreaHeight - tabHeight + 3;
                        }
                    }
                    super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
                }
            });
        }else{
            //t.setUI(new javax.swing.plaf.metal.MetalTabbedPaneUI() {
            tabbedPane.setUI(new BasicTabbedPaneUI() {
                private static final int tabAreaHeight = 32;
                @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
                    return tabAreaHeight;
                }
                @Override protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) {
                    if(tabPane.getSelectedIndex()!=tabIndex && tabPlacement!=JTabbedPane.LEFT && tabPlacement!=JTabbedPane.RIGHT) {
                        int tabHeight = tabAreaHeight/2 + 3;
                        rects[tabIndex].height = tabHeight;
                        if(tabPlacement==JTabbedPane.TOP) {
                            rects[tabIndex].y = tabAreaHeight - tabHeight + 3;
                        }
                    }
                    super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect);
                }
            });
        }
        tabbedPane.addTab("00000", new JLabel("aaaaaaaaaaa"));
        tabbedPane.addTab("111112", new JLabel("bbbbbbbbbbbbbbbb"));
        tabbedPane.addTab("22222232", new JScrollPane(new JTree()));
        tabbedPane.addTab("3333333333", new JSplitPane());
        add(tabbedPane);
        add(box, BorderLayout.SOUTH);
        setPreferredSize(new Dimension(320, 240));
{'fraction_non_alphanumeric': 0.10517435320584927, 'fraction_numerical': 0.013048368953880765, 'mean_word_length': 2.087152777777778, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '6098690', 'n_tokens_mistral': 2619, 'n_tokens_neox': 2429, 'n_words': 464}