1 package eu.svjatoslav.instantlauncher;
3 import java.awt.BorderLayout;
4 import java.awt.Dimension;
6 import java.awt.event.WindowEvent;
7 import java.awt.event.WindowListener;
9 import javax.swing.JFrame;
11 import eu.svjatoslav.instantlauncher.menu.MultiLevelMenu;
13 public class MainFrame {
15 public static class FrameWindowListener implements WindowListener {
18 public void windowActivated(final WindowEvent e) {
22 public void windowClosed(final WindowEvent e) {
26 public void windowClosing(final WindowEvent e) {
27 InstantLauncher.exitProgram();
31 public void windowDeactivated(final WindowEvent e) {
35 public void windowDeiconified(final WindowEvent e) {
39 public void windowIconified(final WindowEvent e) {
43 public void windowOpened(final WindowEvent e) {
50 private boolean isShowing;
52 public static final Dimension CONTENT_PANEL_SIZE = new Dimension(1100, 850);
53 public static final Point INITIAL_LOCATION = new Point(100, 30);
55 private final InstantLauncher instantLauncher;
57 public MainFrame(final InstantLauncher instantLauncher) {
58 this.instantLauncher = instantLauncher;
61 private void buildContentPane() {
63 final MultiLevelMenu multiLevelMenu = new MultiLevelMenu(instantLauncher);
64 frame.getContentPane().add(multiLevelMenu.buildContentPanel(), BorderLayout.CENTER);
72 frame = new JFrame("InstantLauncher");
76 frame.setSize(CONTENT_PANEL_SIZE);
77 frame.setVisible(true);
78 frame.setLocation(INITIAL_LOCATION);
80 // registor window listener
81 final FrameWindowListener windowListener = new FrameWindowListener();
82 frame.addWindowListener(windowListener);
85 frame.setExtendedState(JFrame.MAXIMIZED_BOTH);