Implement the methods of main window