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

package example;

import com.sun.java.swing.plaf.windows.WindowsToolBarUI;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicToolBarUI;

public final class MainPanel extends JPanel {
  private final JCheckBox movable = new JCheckBox("Floatable(movable)", true);
  private final JButton button = new JButton("button");

  private MainPanel() {
    super(new BorderLayout());
    JCheckBox detachable = new JCheckBox("Floating(detachable)", false);

    JToolBar toolbar = new JToolBar("toolbar") {
      @Override public void updateUI() {
        super.updateUI();
        if (getUI() instanceof WindowsToolBarUI) {
          setUI(new WindowsToolBarUI() {
            @Override public void setFloating(boolean b, Point p) {
              if (detachable.isSelected()) {
                super.setFloating(b, p);
              } else {
                super.setFloating(false, p);
              }
            }
          });
        } else {
          setUI(new BasicToolBarUI() {
            @Override public void setFloating(boolean b, Point p) {
              if (detachable.isSelected()) {
                super.setFloating(b, p);
              } else {
                super.setFloating(false, p);
              }
            }
          });
        }
      }
    };
    toolbar.add(new JLabel("label"));
    toolbar.add(Box.createRigidArea(new Dimension(5, 5)));
    toolbar.add(button);
    toolbar.add(Box.createRigidArea(new Dimension(5, 5)));
    toolbar.add(new JComboBox<>(makeModel()));
    toolbar.add(Box.createGlue());

    movable.addActionListener(e -> toolbar.setFloatable(((JCheckBox) e.getSource()).isSelected()));
    button.setFocusable(false);

    JPanel p = new JPanel();
    p.add(movable);
    p.add(detachable);
    add(toolbar, BorderLayout.NORTH);
    add(p);
    setPreferredSize(new Dimension(320, 240));
  }

  private static ComboBoxModel<String> makeModel() {
    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
    model.addElement("1111111");
    model.addElement("22222");
    model.addElement("3333333333333333");
    model.addElement("44444444444");
    return model;
  }

  public static void main(String[] args) {<commit_msg>refactor: field can be converted to a local variable<commit_after>// -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@

package example;

import com.sun.java.swing.plaf.windows.WindowsToolBarUI;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicToolBarUI;

public final class MainPanel extends JPanel {
  private MainPanel() {
    super(new BorderLayout());
    JCheckBox detachable = new JCheckBox("Floating(detachable)", false);

    JButton button = new JButton("button");
    button.setFocusable(false);

    JToolBar toolbar = new JToolBar("toolbar") {
      @Override public void updateUI() {
        super.updateUI();
        if (getUI() instanceof WindowsToolBarUI) {
          setUI(new WindowsToolBarUI() {
            @Override public void setFloating(boolean b, Point p) {
              if (detachable.isSelected()) {
                super.setFloating(b, p);
              } else {
                super.setFloating(false, p);
              }
            }
          });
        } else {
          setUI(new BasicToolBarUI() {
            @Override public void setFloating(boolean b, Point p) {
              if (detachable.isSelected()) {
                super.setFloating(b, p);
              } else {
                super.setFloating(false, p);
              }
            }
          });
        }
      }
    };
    toolbar.add(new JLabel("label"));
    toolbar.add(Box.createRigidArea(new Dimension(5, 5)));
    toolbar.add(button);
    toolbar.add(Box.createRigidArea(new Dimension(5, 5)));
    toolbar.add(new JComboBox<>(makeModel()));
    toolbar.add(Box.createGlue());

    JCheckBox movable = new JCheckBox("Floatable(movable)", true);
    movable.addActionListener(e -> toolbar.setFloatable(((JCheckBox) e.getSource()).isSelected()));

    JPanel p = new JPanel();
    p.add(movable);
    p.add(detachable);
    add(toolbar, BorderLayout.NORTH);
    add(p);
    setPreferredSize(new Dimension(320, 240));
  }

  private static ComboBoxModel<String> makeModel() {
    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
    model.addElement("1111111");
    model.addElement("22222");
    model.addElement("3333333333333333");
    model.addElement("44444444444");
    return model;
  }

  public static void main(String[] args) {
{'fraction_non_alphanumeric': 0.134528179658821, 'fraction_numerical': 0.022025480457784494, 'mean_word_length': 2.644374508261212, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '7584457', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1396, 'n_words': 278}