//@author A0116538A

package bakatxt.gui;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;

import bakatxt.core.BakaTxtMain;

// TODO comments
public class BakaUI extends JFrame {

    private static BakaPanel _baka;

    public BakaUI(BakaTxtMain thisSession) {
        initUI(thisSession);
    }

    public static void startGui() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                BakaTxtMain thisSession = new BakaTxtMain();
                BakaUI baka = new BakaUI(thisSession);
                baka.setVisible(true);
                processInput(thisSession);
            }
        });
    }

    public static void processInput(BakaTxtMain thisSession) {

        Input input = _baka.getInput();
        input.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                input.selectAll();
                BakaTxtMain.executeCommand(input.getText());
                _baka.setContents(thisSession);
            }
        });
    }

    private void initUI(BakaTxtMain thisSession) {
        _baka = new BakaPanel(thisSession);
        setUndecorated(true);
        setBackground(UIHelper.TRANSPARENT);
        setContentPane(_baka);
        pack();
        setLocationRelativeTo(null); // centers the window on screen
        setAlwaysOnTop(true);
        setTitle("Baka TX");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
}

@@ -205,548 +205,1430 @@
 ;%0A%0A/
-/ TODO comments%0Apublic class BakaUI extends JFrame %7B%0A%0A    private static BakaPanel _baka;%0A%0A    public BakaUI(BakaTxtMain thisSession) %7B%0A        initUI(thisSession);%0A    %7D%0A%0A    public static void startGui() %7B%0A        EventQueue.invokeLater(new Runnable() %7B%0A            @Override%0A            public void run() %7B%0A                BakaTxtMain thisSession = new BakaTxtMain();%0A                BakaUI baka = new BakaUI(thisSession);%0A                baka.setVisible(true);%0A                processInput(thisSession);%0A            %7D%0A        %7D);%0A    %7D%0A
+**%0A * BakaUI is the %22main window%22 of the GUI for BakaTXT. Since we are doing a custom%0A * window design, BakaUI is actually completely transparent. We will instead draw%0A * a BakaPanel that fills the BakaUI window, and treat it as our actual window.%0A *%0A */%0Apublic class BakaUI extends JFrame %7B%0A%0A    private static BakaPanel _baka;%0A%0A    /**%0A     * @param thisSession refers to the logic module we are interacting with%0A     */%0A    public BakaUI(BakaTxtMain thisSession) %7B%0A        initUI(thisSession);%0A    %7D%0A%0A    /**%0A     * This method initializes the GUI and updates it when necessary%0A     */%0A    public static void startGui() %7B%0A        EventQueue.invokeLater(new Runnable() %7B%0A            @Override%0A            public void run() %7B%0A                BakaTxtMain thisSession = new BakaTxtMain();%0A                BakaUI baka = new BakaUI(thisSession);%0A                baka.setVisible(true);%0A                processInput(thisSession);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    /**%0A     * This method listens for input from the GUI and does the following when the%0A     * return key is pressed:%0A     *%0A     * 1. Highlight all the text in the input box (to make it trivial for the user%0A     *    to input new commands)%0A     * 2. Passes the input to the logic module to process it%0A     * 3. Lastly, updates the contents of the GUI to fit the command%0A     *%0A     * @param thisSession refers to the logic module we are interacting with%0A     */
 %0A   
@@ -2036,24 +2036,246 @@
  %7D);%0A    %7D%0A%0A
+    /**%0A     * This method draws the BakaPanel and sets the window as transparent, centered,%0A     * unmovable, and always on top.%0A     *%0A     * @param thisSession refers to the logic module we are interacting with%0A     */%0A
     private 

Create Javadoc comments for BakaUI