package gui; import static java.awt.BorderLayout.CENTER; import static java.awt.BorderLayout.NORTH; import static java.awt.BorderLayout.SOUTH; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JOptionPane; import javax.swing.JFrame; import javax.swing.JPanel; import tasks.Taskset; import model.SchedulingModel; import model.Status; import gui.menu.ScheduLearnMenuBar; import gui.schedulegui.SchedulePanel; import gui.tasksetgui.TasksetPanel; public class ScheduLearn extends JFrame { public ScheduLearn() { super("ScheduLearn"); int rows = 5, cols = 20; Status status = new Status(); Taskset ts = new Taskset(); CurrentSlot currentSlot = new CurrentSlot(1, 1); StatusLabel statusLabel = new StatusLabel(status); SchedulingModel scheduleMdl = new SchedulingModel(ts, status); // ................ JPanel tasksetPanel = new TasksetPanel(ts); JPanel schedulePanel = new SchedulePanel(scheduleMdl, currentSlot, rows, cols); JPanel actionPanel = new ActionPanel(tasksetPanel, schedulePanel); // ................ add(CENTER, statusLabel); add(SOUTH, actionPanel); setJMenuBar(new ScheduLearnMenuBar(this, scheduleMdl, ts, status)); pack(); // Create Closing mechanism setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { confirmAndExit(); } }); setResizable(false); setVisible(true); } // Used to confirm that the application should be exited. public void confirmAndExit() { if (JOptionPane.showConfirmDialog( this, "Are you sure you want to quit?", "Please confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { System.exit(0); } } public static void main(String[] args) { new ScheduLearn(); } }