<commit_before>package engine;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;

public class ClickFrame extends JFrame {

    Object object;
    int shapeIndex;
    Main.MyJPanel mainPanel;

    public ClickFrame(Main.MyJPanel mainPane, Object objec, Shape shape) {
        setTitle("");

        object = objec;
        mainPanel = mainPane;
        shapeIndex = object.shapes.indexOf(shape);

        MyPanel panel = new MyPanel();

        setContentPane(panel);
        getContentPane().setPreferredSize(new Dimension(200, 100));
        pack();
        addWindowListener(windowListener());
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setResizable(false);
        setAlwaysOnTop(true);
        setLocation((int) (mainPanel.getLocationOnScreen().x + object.position.x + 70), (int) (mainPanel.getLocationOnScreen().y + object.position.y - 150));
        setVisible(true);

        if (!Main.playing) {
            mainPanel.repaint();
        }
    }

    private WindowAdapter windowListener() {
        return new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                mainPanel.clickFrameList.remove(ClickFrame.this);
                if (!Main.playing) {
                    mainPanel.repaint();
                }
            }
        };
    }

    class MyPanel extends JPanel {

        public MyPanel() {
            setLayout(new GridLayout(2, 3, 5, 5));
            addButtonsLabels();
            addKeyBindings();

            MouseAdapter ma = mouseAdapter();
            addMouseListener(ma);
            addMouseMotionListener(ma);
            addMouseWheelListener(ma);
        }

        JLabel label1;
        JLabel label2;
        JLabel label3;
        JLabel label4;

        @Override
        protected void paintComponent(Graphics g) {

        }

        private void addButtonsLabels() {
            JButton button1 = new JButton("Follow this");
            button1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    mainPanel.world.followID = mainPanel.world.objects.indexOf(object);
                    mainPanel.world.follow = true;
                    if (!Main.playing) {
                        mainPanel.repaint();
                    }
                }
            });
            add(button1);
            add(new JLabel(""));

            label4 = new JLabel("I : " + object.inertia, SwingConstants.CENTER); 
            add(label4);
            label1 = new JLabel("P : " + object.position, SwingConstants.CENTER);
            add(label1);
            label2 = new JLabel("V : " + object.velocity, SwingConstants.CENTER);
            add(label2);
            label3 = new JLabel("AV : " + object.angularVelocity, SwingConstants.CENTER);
            add(label3);
        }

        private void addKeyBindings() {
            getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_0, 0), "keyBinding");
            getActionMap().put("keyBinding", keyBinding());
        }

        private Action keyBinding() {
            return new AbstractAction() {
                @Override
                public void actionPerformed(ActionEvent e) {
                }
            };
        }

        private MouseAdapter mouseAdapter() {
            return new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent me) {
                }
            };
        }
    }
}<commit_msg>clickFrame DONEish<commit_after>package engine;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

public class ClickFrame extends JFrame {

    Object object;
    int shapeIndex;
    Main.MyJPanel mainPanel;

    public ClickFrame(Main.MyJPanel mainPane, Object objec, Shape shape) {
        setTitle("");

        object = objec;
        mainPanel = mainPane;
        shapeIndex = object.shapes.indexOf(shape);

        MyPanel panel = new MyPanel();

        setContentPane(panel);
        getContentPane().setPreferredSize(new Dimension(200, 200));
        pack();
        addWindowListener(windowListener());
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setResizable(false);
        setAlwaysOnTop(true);
        setLocation((int) (mainPanel.getLocationOnScreen().x + object.position.x + 70), (int) (mainPanel.getLocationOnScreen().y + object.position.y - (getHeight()+50)));
        setVisible(true);

        if (!Main.playing) {
            mainPanel.repaint();
        }
    }

    private WindowAdapter windowListener() {
        return new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                mainPanel.clickFrameList.remove(ClickFrame.this);
                if (!Main.playing) {
                    mainPanel.repaint();
                }
            }
        };
    }

    class MyPanel extends JPanel {

        public MyPanel() {
            setLayout(new GridLayout(7, 1, 5, 5));
            addButtonsLabels();
        }

        JLabel positionLabel;
        JLabel velocityLabel;
        JLabel angularVelocityLabel;
        JLabel inertiaLabel;
        JLabel massLabel;

        private void addButtonsLabels() {
            JButton button1 = new JButton("Follow this");
            button1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    mainPanel.world.followID = mainPanel.world.objects.indexOf(object);
                    mainPanel.world.follow = true;
                    if (!Main.playing) {
                        mainPanel.repaint();
                    }
                }
            });
            add(button1);

            String[] matArray = {"Wood", "Steel", "Rubber", "Concrete", "Ice", "Glass", "Boost", "Slow"};
            final JComboBox comboBox = new JComboBox(matArray);
            comboBox.setSelectedIndex(object.material);
            comboBox.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    object.material = comboBox.getSelectedIndex();
                }
            });
            add(comboBox);
            
            massLabel = new JLabel("M : " + object.mass, SwingConstants.CENTER);
            add(massLabel);
            inertiaLabel = new JLabel("I : " + object.inertia, SwingConstants.CENTER); 
            add(inertiaLabel);
            positionLabel = new JLabel("P : " + object.position, SwingConstants.CENTER);
            add(positionLabel);
            velocityLabel = new JLabel("V : " + object.velocity, SwingConstants.CENTER);
            add(velocityLabel);
            angularVelocityLabel = new JLabel("AV : " + object.angularVelocity, SwingConstants.CENTER);
            add(angularVelocityLabel);
        }
    }
}
{'fraction_non_alphanumeric': 0.10227272727272728, 'fraction_numerical': 0.006327479338842975, 'mean_word_length': 1.9845857418111754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4595709', 'n_tokens_mistral': 2136, 'n_tokens_neox': 2024, 'n_words': 407}