package tech.nevets.jaml.gui;

import tech.nevets.jaml.JAML;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class GUI implements ActionListener {
    //TODO Add important things on instead of POC

    private int count = 0;
    JFrame frame;
    JPanel panel;
    JButton button;
    JLabel label;

    public GUI() {
        frame = new JFrame();

        button = new JButton("Click me!");
        button.addActionListener(this);

        label = new JLabel("Number of Clicks: 0");

        panel = new JPanel();
        panel.setBorder(BorderFactory.createEmptyBorder(300, 300, 100, 300));
        panel.setLayout(new GridLayout(0, 1));
        panel.add(button);
        panel.add(label);

        frame.add(panel, BorderLayout.CENTER);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("JAML");
        frame.setIconImage(new ImageIcon(JAML.path + "\\assets\\icon.png").getImage());
        frame.pack();
        frame.setVisible(true);
    }

    public static void startGui() {
        new GUI();
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        count++;
        label.setText("Number of Clicks: " + count);
    }
}
