MainWindow.java - move 'main' as a function