This is happening because of 2 displays. Java does not know which display is considered the Main Display, causing it to create a crash. Here are the steps to fix the problem. You can either disconnect a display, or mirror displays. Then the problem will be fixed!
This is not a glitch. You can't do this, but Enderman know how. I don't know?