<commit_before>package com.kirinpatel.sync.gui;

import com.kirinpatel.sync.Sync;
import com.kirinpatel.sync.net.NetworkUser;
import com.kirinpatel.sync.net.Server;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static com.kirinpatel.sync.gui.PlaybackPanel.PANEL_TYPE.CLIENT;
import static com.kirinpatel.sync.gui.PlaybackPanel.PANEL_TYPE.SERVER;

public final class Launcher extends JFrame  {

    public static final Launcher INSTANCE = new Launcher();
    public NetworkUser connectedUser;

    private Launcher() {}

    public void open() {
        setTitle("sync");
        setSize(new Dimension(225, 115));
        setResizable(false);
        setLayout(new BorderLayout());
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
        JButton hostServer = new JButton("Host");
        hostServer.addActionListener(new LauncherButtonEvent(SERVER));
        buttonPanel.add(hostServer);
        JButton joinServer = new JButton("Join");
        joinServer.addActionListener(new LauncherButtonEvent(CLIENT));
        buttonPanel.add(joinServer);
        add(buttonPanel, BorderLayout.CENTER);

        setVisible(true);
        Sync.connectedUsers.clear();
        ControlPanel.showUserTimes = false;
    }

    class LauncherButtonEvent implements ActionListener, ServerIPAddressInputListener {

        private PlaybackPanel.PANEL_TYPE type;

        LauncherButtonEvent(PlaybackPanel.PANEL_TYPE type) {
            this.type = type;
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);

            switch(type) {
                case SERVER:
                    new Server();
                    setVisible(false);
                    break;
                case CLIENT:
                    new ServerIPAddressInput().setListener(this);
                    break;
            }
        }

        @Override
        public void closed() {
            setVisible(true);
        }
    }
}<commit_msg>Moved launcher initializer code to constructor<commit_after>package com.kirinpatel.sync.gui;

import com.kirinpatel.sync.Sync;
import com.kirinpatel.sync.net.NetworkUser;
import com.kirinpatel.sync.net.Server;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static com.kirinpatel.sync.gui.PlaybackPanel.PANEL_TYPE.CLIENT;
import static com.kirinpatel.sync.gui.PlaybackPanel.PANEL_TYPE.SERVER;

public final class Launcher extends JFrame  {

    public static final Launcher INSTANCE = new Launcher();
    public NetworkUser connectedUser;

    private Launcher() {
        setTitle("sync");
        setSize(new Dimension(225, 115));
        setResizable(false);
        setLayout(new BorderLayout());
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
        JButton hostServer = new JButton("Host");
        hostServer.addActionListener(new LauncherButtonEvent(SERVER));
        buttonPanel.add(hostServer);
        JButton joinServer = new JButton("Join");
        joinServer.addActionListener(new LauncherButtonEvent(CLIENT));
        buttonPanel.add(joinServer);
        add(buttonPanel, BorderLayout.CENTER);

        Sync.connectedUsers.clear();
        ControlPanel.showUserTimes = false;
    }

    public void open() {
        setLocationRelativeTo(null);
        setVisible(true);
    }

    class LauncherButtonEvent implements ActionListener, ServerIPAddressInputListener {

        private PlaybackPanel.PANEL_TYPE type;

        LauncherButtonEvent(PlaybackPanel.PANEL_TYPE type) {
            this.type = type;
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);

            switch(type) {
                case SERVER:
                    new Server();
                    setVisible(false);
                    break;
                case CLIENT:
                    new ServerIPAddressInput().setListener(this);
                    break;
            }
        }

        @Override
        public void closed() {
            open();
        }
    }
}
{'fraction_non_alphanumeric': 0.09036422314430613, 'fraction_numerical': 0.0036883356385431073, 'mean_word_length': 2.4354711005542358, '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': '5758661', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1177, 'n_words': 231}