You must do a setBounds() to the window. 

This is an example to center the window. Hope this can help. :-)

private void center(Frame frame)
  {
    int   width, height;
    int   offsetX, offsetY;

    if ( frame==null )
      {
      // Center to desktop
      Dimension desktopSize = Toolkit.getDefaultToolkit().getScreenSize();

      width  = desktopSize.width;
      height  = desktopSize.height;
      offsetX  = 0;
      offsetY = 0;
      }
      else
      {
      // Center to frame
      Rectangle rec = frame.getBounds();

      width  = rec.width;
      height  = rec.height;
      offsetX  = rec.x;
      offsetY = rec.y;
      }

    Rectangle windowSize = getBounds();

    setBounds( (width   - windowSize.width )/2  + offsetX,
                       (height - windowSize.height)/2  + offsetY,
                       windowSize.width, windowSize.height   );
  }



-------------------------------------------------------------
                 Jose Luis Rando Calvo
       Area de Investigaci�n y Desarrollo
       Estudio Inform�tica Software S.L.U.
             � � ----==== Grupo EI ====---- � �
-------------------------------------------------------------

>>> Doug Fields <[EMAIL PROTECTED]> 06/19 7:09  >>>
Hello,

(I'm using NetBeans 3.2, but that doesn't matter much for this question.)

How can I tell Java that when the window is opened (a JFrame or JDialog) 
that I want its opening location to be whatever the window manager (in this 
case, Windows 2000, but whatever) to choose its location?

All my windows are opening up in the top left corner and this is not 
helpful to have them all on top of each other and in a bad place on the 
screen to boot.

Thanks,

Doug

_______________________________________________
Swing mailing list
[EMAIL PROTECTED] 
http://eos.dk/mailman/listinfo/swing

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to