code: public static void snapWindowTo(Window win, int location)
  	{
  		Dimension _screen = Toolkit.getDefaultToolkit().getScreenSize();
  		Dimension _window = win.getSize();
  		int _wx = 0;
  		int _wy = 0;
  		switch (location)
  		{
  			case TOP_LEFT:
  				break;
  			case TOP_CENTER:
  				_wx = (_screen.width - _window.width) / 2;
  				break;
  			case TOP_RIGHT:
  				_wx = _screen.width - _window.width;
  				break;
  			case MIDDLE_LEFT:
  				_wy = (_screen.height - _window.height) / 2;
  				break;
  			case MIDDLE_CENTER:
  				_wx = (_screen.width - _window.width) / 2;
  				_wy = (_screen.height - _window.height) / 2;
  				break;
  			case MIDDLE_RIGHT:
  				_wx = _screen.width - _window.width;
  				_wy = (_screen.height - _window.height) / 2;
  				break;
  			case BOTTOM_LEFT:
  				_wy = _screen.height - _window.height;
  				break;
  			case BOTTOM_CENTER:
  				_wx = (_screen.width - _window.width) / 2;
  				_wy = _screen.height - _window.height;
  				break;
  			case BOTTOM_RIGHT:
  				_wx = _screen.width - _window.width;
  				_wy = _screen.height - _window.height;
  				break;
  		}
  		win.setLocation(new Point(_wx, _wy));
  	}
docs: Snap the Window Position to a special location.
  
  @param win
  The Window to move
  @param location
  A value among the allowed predefined positions