package views; import controls.StepScheduler; import models.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"); stepScheduler = new StepScheduler(); var mainPanel = new MainPanel(stepScheduler); 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(stepScheduler); } @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) { } }); } }