Your Computer Science Resource

Archive for the ‘GUI’ Category

Jun
9th

HOW-TO: Center a JFrame On The Screen

If you want to add a nice touch to your GUI application, have your JFrame automatically center on the user’s screen. Not only does this looks much better than having it start up in the default (0, 0) location, but it takes very little coding effort to make this happen. There are two methods for doing this, depending on which version of Java you are using. I will show you how to do it both ways, though most of you can follow the first method.

(more…)