Article View: borland.public.jbuilder.java.swing
Article #12219Centering JInternalFrame into JDesktopPane
From: C Javier Castro Peña
Date: Mon, 15 Feb 1999 00:00
Date: Mon, 15 Feb 1999 00:00
16 lines
1154 bytes
1154 bytes
How may I center a JInternalFrame, into a JDesktopPane. With JBCL
frames, I used the following code:
//Center the window
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
if (frameSize.height > screenSize.height)
frameSize.height = screenSize.height;
if (frameSize.width > screenSize.width)
frameSize.width = screenSize.width;
this.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
But it doesn't work well with swing frames.
Technical Details
Message-ID:
<36C85BD2.AA3F769D@ittc.ukans.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,925b7f9adaaf2ecf,start X-Google-Attributes: gid111d45,public From: C Javier Castro Peña <jcaspen@ittc.ukans.edu> Subject: Centering JInternalFrame into JDesktopPane Date: 1999/02/15 Message-ID: <36C85BD2.AA3F769D@ittc.ukans.edu> X-Deja-AN: 444645111 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: ITTC - University of Kansas Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing