Java codes for the Main Layout