A neat example, which works well on OS X is given here:
http://java.sun.com/docs/books/tutorial/extra/fullscreen/example-1dot4/DisplayModeTest.java
I also suggest this link for further explanations:
http://java.sun.com/docs/books/tutorial/extra/fullscreen/example.html
Finally, I'd like to mention that because of the nature of exclusive full screen mode and possibly an implementation error on Macintosh, contextual menus (Popup menus) may not work as expected. I observed two behaviors:
- contextual menu are simply not drawn or not visible
or
- once a popup menu is closed, the screen turns black
I have devised a rather short pure-Java work-around which solves both problems, and is multi-platform friendly.