The second approach is definitely not a hack - it's documented behaviour:
If the component is not currently showing, or c is null, the window is placed at the center of the screen. The center point can be determined with GraphicsEnvironment.getCenterPoint.
I used to do it the hard way, but these days I always use setLocationRelativeTo(null).
Also, the latter has one advantage - it ignores the not-usable part of the screen, like the task bar. It doesn't use the entire screen size through Toolkit.getScreenSize() but uses GraphicsEnvironment.getMaximumWindowBounds().