Article View: borland.public.jbuilder.java.swing
Article #10278Re: Math for centering dialog box inside a main frame
From: Lois Neo
Date: Sat, 23 Oct 1999 00:00
Date: Sat, 23 Oct 1999 00:00
30 lines
1627 bytes
1627 bytes
Hi, I know for JDialogs, there is a method setLocationRelativeTo(Component) which could display the dialog at a location respective to a certain component (centralised), say a frame. Hope it helps. Lois Jeff Marendo <marendoj@commos.com> wrote in message news:7upraq$npj6@forums.borland.com... > Hello, > > I have tried to use what appears to be somewhat of a standard math equation > for always centering a dialog window (in my case, an 'About' box from the > Help menu), but the window doesn't appear centered when executed. It is > also misaligned if I resize the main window. > > Ideally, I'd like to have the 'About' dialog always appear within the > confines of the window in which it was opened from (and have it be > completely visible). I tried basing my algorithm off of the main frame's > width and height (and the dialog's): it almost centers it, but this is > pretty much hardcoding it into one spot. I know I have to use the sizes. > > Please advise. Thanks! > > Jeff > >
Technical Details
Message-ID:
<7urvdg$8up11@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7upraq$npj6@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,869a3aa575acdb31 X-Google-Attributes: gid111d45,public From: "Lois Neo" <slneo@cybergal.com> Subject: Re: Math for centering dialog box inside a main frame Date: 1999/10/23 Message-ID: <7urvdg$8up11@forums.borland.com> X-Deja-AN: 539577510 References: <7upraq$npj6@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Reply-To: "Lois Neo" <slneo@cybergal.com> Newsgroups: borland.public.jbuilder.java.swing