I want create a rectangle using the whole screen. By using the whole screen, I mean something like this:
You could look into creating a transparent fullscreen JFrame.This would not be an ideal technique though.
You can have a look at this to get you started on a real solution.