Grab mouse using OpenGL

in LWJGL 2, there is a function in the Mouse class named setGrabbed(). I want similar functionality like that.