Newer
Older
Algolike / src / main / java / views / MainFrame.java
package views;

import controls.StepScheduler;
import resources.Algo;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

public class MainFrame extends JFrame {
    StepScheduler stepScheduler;

    public MainFrame() {
        super("Algolike");
        var mainPanel = new MainPanel(new Algo());
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        mainPanel.setVisible(true);
        this.add(mainPanel, BorderLayout.CENTER);
        this.pack();
        this.addWindowListener(new WindowListener() {
            @Override
            public void windowOpened(WindowEvent e) {
                mainPanel.playerBehave();
            }

            @Override
            public void windowClosing(WindowEvent e) {

            }

            @Override
            public void windowClosed(WindowEvent e) {

            }

            @Override
            public void windowIconified(WindowEvent e) {

            }

            @Override
            public void windowDeiconified(WindowEvent e) {

            }

            @Override
            public void windowActivated(WindowEvent e) {

            }

            @Override
            public void windowDeactivated(WindowEvent e) {

            }
        });
    }
}