<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package processing_test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import net.iharder.dnd.FileDrop;

/**
 * @author nikla_000
 */
public class DisplayFrame extends JFrame implements ActionListener {

    //private final CircleSketch sketch;
    private final JButton fileChooseButton;
    private final JButton button;
    private final JButton fncButton2;
    private final JButton fncButton3;
    private final JButton clearButton;
    private final JButton doubleSpeed;
    private final JButton tripleSpeed;
    private final JButton saveButton;
    private final JButton blankButton;
    private final JButton backButton;
    private final JButton forwardButton;
    private final JButton cloneButton;
    private final JButton setPoints;
    private final JLabel step1;
    private final JLabel step2;
    private final JLabel step3;
    private final JLabel sliderLabel;

    private final ProcessImage imageProcessor;
    private JPanel panel;
    private final JSlider slider;

    SampleSketch s;

    /**
     * Constructor for instances of class DisplayFrame. Initializes all
     * components of the GUI as well as the processing sketch.
     */
    public DisplayFrame() throws IOException {
        this.setSize(1600, 850);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        button = new JButton("Start");
        fncButton2 = new JButton("Pixelate");
        fncButton3 = new JButton("Show dots");
        clearButton = new JButton("Clear Canvas");
        doubleSpeed = new JButton("2X Speed");
        tripleSpeed = new JButton("3X Speed");
        cloneButton = new JButton("Clone");
        setPoints = new JButton("Set Points");
        imageProcessor = new ProcessImage();

        fileChooseButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/OpenButton.gif"))));
        saveButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/Save-icon.png"))));
        blankButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/blank.jpg"))));
        backButton = new JButton("<");
        forwardButton = new JButton(">");

        step1 = new JLabel("Step1: Choose a picture");
        step2 = new JLabel("Step2: Choose a function");
        step3 = new JLabel("Step3: Edit the result");
        sliderLabel = new JLabel("Change size of \"pixels\"");

        slider = new JSlider(JSlider.HORIZONTAL, 4, 30, 20);

        fncButton3.setToolTipText("Show a dot representation for your picture");

        arrangeLayout();

        s = new SampleSketch();
        s.setButtons(forwardButton, backButton);

        setActionListeners(s);
        s.init(); //this is the function used to start the execution of the sketch

        panel.add(s);
        this.add(panel);
        this.add(button);
        this.add(fileChooseButton);
        this.add(clearButton);
        this.add(fncButton2);
        this.add(fncButton3);
        this.add(doubleSpeed);
        this.add(tripleSpeed);
        this.add(step1);
        this.add(step2);
        this.add(step3);
        this.add(sliderLabel);
        this.add(slider);
        this.add(saveButton);
        this.add(blankButton);
        this.add(backButton);
        this.add(forwardButton);
        this.add(cloneButton);
        this.add(setPoints);

        this.setVisible(true);
    }

    /**
     * Arranges the layout of the panel and buttons.
     */
    private void arrangeLayout() {
        setLayout(null);

        panel = new JPanel();

        blankButton.setBounds(20, 10, 50, 50);
        saveButton.setBounds(80, 10, 50, 50);
        fileChooseButton.setBounds(140, 10, 50, 50);
        backButton.setBounds(220, 10, 50, 50);
        forwardButton.setBounds(280, 10, 50, 50);
        cloneButton.setBounds(340, 10, 100, 50);
        setPoints.setBounds(450, 10, 100, 50);
        fncButton2.setBounds(1320, 275, 100, 50);
        fncButton3.setBounds(1435, 275, 100, 50);
        panel.setBounds(20, 70, 1280, 720);
        button.setBounds(1320, 1445, 100, 50);
        clearButton.setBounds(1320, 420, 215, 50);
        doubleSpeed.setBounds(1320, 490, 100, 50);
        tripleSpeed.setBounds(1435, 490, 100, 50);
        slider.setBounds(1320, 590, 215, 20);

        step1.setBounds(1320, 105, 150, 30);
        step2.setBounds(1320, 235, 150, 30);
        step3.setBounds(1320, 380, 150, 30);
        sliderLabel.setBounds(1360, 560, 150, 30);
<commit_msg>Litt småpirk<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package processing_test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import net.iharder.dnd.FileDrop;

/**
 * @author nikla_000
 */
public class DisplayFrame extends JFrame implements ActionListener {

    //private final CircleSketch sketch;
    private final JButton fileChooseButton;
    private final JButton button;
    private final JButton fncButton2;
    private final JButton fncButton3;
    private final JButton clearButton;
    private final JButton doubleSpeed;
    private final JButton tripleSpeed;
    private final JButton saveButton;
    private final JButton blankButton;
    private final JButton backButton;
    private final JButton forwardButton;
    private final JButton cloneButton;
    private final JButton setPoints;
    private final JLabel step1;
    private final JLabel step2;
    private final JLabel step3;
    private final JLabel sliderLabel;

    private final ProcessImage imageProcessor;
    private JPanel panel;
    private final JSlider slider;

    SampleSketch s;

    /**
     * Constructor for instances of class DisplayFrame. Initializes all
     * components of the GUI as well as the processing sketch.
     */
    public DisplayFrame() throws IOException {
        this.setSize(1600, 850);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        button = new JButton("Start");
        fncButton2 = new JButton("Pixelate");
        fncButton3 = new JButton("Show dots");
        clearButton = new JButton("Clear Canvas");
        doubleSpeed = new JButton("2X Speed");
        tripleSpeed = new JButton("3X Speed");
        cloneButton = new JButton("Clone");
        setPoints = new JButton("Set Points");
        imageProcessor = new ProcessImage();

        fileChooseButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/OpenButton.gif"))));
        saveButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/Save-icon.png"))));
        blankButton = new JButton(new ImageIcon(ImageIO.read(new File("graphics/blank.jpg"))));
        backButton = new JButton("<");
        forwardButton = new JButton(">");

        step1 = new JLabel("Step1: Choose a picture");
        step2 = new JLabel("Step2: Choose a function");
        step3 = new JLabel("Step3: Edit the result");
        sliderLabel = new JLabel("Change size of \"pixels\"");

        slider = new JSlider(JSlider.HORIZONTAL, 4, 30, 20);

        fncButton3.setToolTipText("Show a dot representation for your picture");

        arrangeLayout();

        s = new SampleSketch();
        s.setButtons(forwardButton, backButton);

        setActionListeners(s);
        s.init(); //this is the function used to start the execution of the sketch

        panel.add(s);
        this.add(panel);
        this.add(button);
        this.add(fileChooseButton);
        this.add(clearButton);
        this.add(fncButton2);
        this.add(fncButton3);
        this.add(doubleSpeed);
        this.add(tripleSpeed);
        this.add(step1);
        this.add(step2);
        this.add(step3);
        this.add(sliderLabel);
        this.add(slider);
        this.add(saveButton);
        this.add(blankButton);
        this.add(backButton);
        this.add(forwardButton);
        this.add(cloneButton);
        this.add(setPoints);

        this.setVisible(true);
    }

    /**
     * Arranges the layout of the panel and buttons.
     */
    private void arrangeLayout() {
        setLayout(null);

        panel = new JPanel();

        //Position and size for buttons.
        blankButton.setBounds(20, 10, 50, 50);
        saveButton.setBounds(80, 10, 50, 50);
        fileChooseButton.setBounds(140, 10, 50, 50);
        backButton.setBounds(220, 10, 50, 50);
        forwardButton.setBounds(280, 10, 50, 50);
        cloneButton.setBounds(340, 10, 100, 50);
        setPoints.setBounds(450, 10, 100, 50);
        fncButton2.setBounds(1320, 275, 100, 50);
        fncButton3.setBounds(1435, 275, 100, 50);
        panel.setBounds(20, 70, 1280, 720);
        button.setBounds(1320, 1445, 100, 50);
        clearButton.setBounds(1320, 420, 215, 50);
        doubleSpeed.setBounds(1320, 490, 100, 50);
        tripleSpeed.setBounds(1435, 490, 100, 50);
        slider.setBounds(1320, 590, 215, 20);

        //Position and size for labels
        step1.setBounds(1320, 105, 150, 30);
        step2.setBounds(1320, 235, 150, 30);
        step3.setBounds(1320, 380, 150, 30);
        sliderLabel.setBounds(1360, 560, 150, 30);

{'fraction_non_alphanumeric': 0.10629243084405715, 'fraction_numerical': 0.050258384841422636, 'mean_word_length': 2.893491124260355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6956061', 'n_tokens_mistral': 3259, 'n_tokens_neox': 2844, 'n_words': 793}