<commit_before>package com.trezoragent.gui;

import com.trezoragent.sshagent.ReadTrezorData;
import com.trezoragent.utils.AgentConstants;
import com.trezoragent.utils.AgentUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.border.Border;

/**
 *
 * @author martin.lizner
 */
public class PassphraseDialog extends JFrame {

    final Color WINDOW_BORDER_COLOR = new Color(114, 159, 207); // = logo outter frame color
    private final int FRAME_XSIZE = 230;
    private final int FRAME_YSIZE = 150;

    private static Point mouseDownCompCoords;
    private ReadTrezorData passphraseData;
    private JLabel deviceLabel;
    private JLabel passcodeLabel;
    private JPasswordField passcodeField;
    private JButton enterBtn;
    private JButton cancelBtn;

    JPanel labelPanel = new JPanel();
    JPanel passphrasePanel = new JPanel();
    JPanel passphraseWindowPanel = new JPanel();
    JPanel enterPanel = new JPanel();
    JPanel buttonPanel = new JPanel();

    public PassphraseDialog() {
        init();
        setIconImages(AgentUtils.getAllIcons()); // icon
        addInputArea(); // text input field
        addButtonArea(); // enter + cancel buttons
        addGlobalArea(); // outer panel
    }

    private void init() {
        passphraseData = new ReadTrezorData();
        setUndecorated(true);
        setResizable(false);
        setAlwaysOnTop(true);
        setPreferredSize(new Dimension(FRAME_XSIZE, FRAME_YSIZE));

        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation(dim.width / 2 - getContentPane().getSize().width / 2, dim.height / 2 - getSize().height / 2);
        setVisible(false);

        pack();
        addAbilityToMoveWindow(this);
    }

    private void addInputArea() {
        labelPanel.setLayout(new GridLayout(3, 1));
        Border labelsPadding = BorderFactory.createEmptyBorder(0, 0, 15, 0);
        labelPanel.setBorder(labelsPadding);

        deviceLabel = new JLabel(AgentConstants.APP_PUBLIC_NAME.toUpperCase());
        Icon icon = new ImageIcon(TrayProcess.createImage(AgentConstants.ICON24_PATH, AgentConstants.ICON_DESCRIPTION));
        deviceLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
        deviceLabel.setIcon(icon);
        deviceLabel.setIconTextGap(10);
        deviceLabel.setFont(new Font(null, Font.BOLD, 15));

        passcodeLabel = new JLabel("Please enter passphrase:");
        passcodeField = new JPasswordField();
        passcodeField.setEditable(true);
        passcodeField.setBackground(Color.white);

        labelPanel.add(deviceLabel, BorderLayout.NORTH);
        labelPanel.add(passcodeLabel, BorderLayout.CENTER);<commit_msg>refact<commit_after>package com.trezoragent.gui;

import com.trezoragent.sshagent.ReadTrezorData;
import com.trezoragent.utils.AgentConstants;
import com.trezoragent.utils.AgentUtils;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.border.Border;

/**
 *
 * @author martin.lizner
 */
public class PassphraseDialog extends JFrame {

    final Color WINDOW_BORDER_COLOR = new Color(114, 159, 207); // = logo outter frame color
    private final int FRAME_XSIZE = 230;
    private final int FRAME_YSIZE = 150;

    private static Point mouseDownCompCoords;
    private ReadTrezorData passphraseData;
    private JLabel deviceLabel;
    private JLabel passcodeLabel;
    private JPasswordField passcodeField;
    private JButton enterBtn;
    private JButton cancelBtn;

    JPanel labelPanel = new JPanel();
    JPanel passphrasePanel = new JPanel();
    JPanel passphraseWindowPanel = new JPanel();
    JPanel enterPanel = new JPanel();
    JPanel buttonPanel = new JPanel();

    public PassphraseDialog() {
        init();
        setIconImages(AgentUtils.getAllIcons()); // icon
        addInputArea(); // text input field
        addButtonArea(); // enter + cancel buttons
        addGlobalArea(); // outer panel
    }

    private void init() {
        passphraseData = new ReadTrezorData();
        setUndecorated(true);
        setResizable(false);
        setAlwaysOnTop(true);
        setPreferredSize(new Dimension(FRAME_XSIZE, FRAME_YSIZE));

        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation(dim.width / 2 - getContentPane().getSize().width / 2, dim.height / 2 - getSize().height / 2);
        setVisible(false);

        pack();
        addAbilityToMoveWindow(this);
    }

    private void addInputArea() {
        labelPanel.setLayout(new GridLayout(3, 1));
        Border labelsPadding = BorderFactory.createEmptyBorder(0, 0, 15, 0);
        labelPanel.setBorder(labelsPadding);

        deviceLabel = new JLabel(AgentConstants.APP_PUBLIC_NAME.toUpperCase());
        Icon icon = new ImageIcon(TrayProcess.createImage(AgentConstants.ICON24_PATH, AgentConstants.ICON_DESCRIPTION));
        deviceLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
        deviceLabel.setIcon(icon);
        deviceLabel.setIconTextGap(10);
        deviceLabel.setFont(new Font(null, Font.BOLD, 15));

        passcodeLabel = new JLabel("Please enter passphrase:");
        passcodeField = new JPasswordField();
        passcodeField.setBackground(Color.white);

        labelPanel.add(deviceLabel, BorderLayout.NORTH);
        labelPanel.add(passcodeLabel, BorderLayout.CENTER);
{'fraction_non_alphanumeric': 0.1013681592039801, 'fraction_numerical': 0.011194029850746268, 'mean_word_length': 3.712820512820513, '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': '976704', 'n_tokens_mistral': 1974, 'n_tokens_neox': 1871, 'n_words': 412}