🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10273

Math for centering dialog box inside a main frame

#10273
From: Jeff Marendo
Date: Fri, 22 Oct 1999 00:00
16 lines
1230 bytes
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: <7upraq$npj6@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,869a3aa575acdb31,start
X-Google-Attributes: gid111d45,public
From: "Jeff Marendo" <marendoj@commos.com>
Subject: Math for centering dialog box inside a main frame
Date: 1999/10/22
Message-ID: <7upraq$npj6@forums.borland.com>
X-Deja-AN: 539274345
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Organization: CommTech Corporation
X-MSMail-Priority: Normal
Reply-To: "Jeff Marendo" <marendoj@commos.com>
Newsgroups: borland.public.jbuilder.java.swing