Article View: borland.public.jbuilder.java.language
Article #14605Re: How to handle Frame location?
From: nlaan
Date: Wed, 18 Aug 1999 00:00
Date: Wed, 18 Aug 1999 00:00
28 lines
1391 bytes
1391 bytes
// get the screen size
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
// get the frame size
Dimension frameSize = frame.getSize();
// make sure the frame size is smaller than the screen
if (frameSize.height > screenSize.height)
frameSize.height = screenSize.height;
if (frameSize.width > screenSize.width)
frameSize.width = screenSize.width;
// center the frame
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
HooLee wrote in message <7pd2ha$jr3@forums.borland.com>...
>Hi I am Hoo.
>I want to output JFrame always on center screen.
>I dont know how to do it.
>Thank you.
>
----------------------------------------------------------------------------
nathan laan 341 Avadh Bhatia Physics Building
University of Alberta Edmonton, Alberta, Canada
nlaan@ualberta.ca (780)492-5289
Technical Details
Message-ID:
<7pemhm$27i12@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7pd2ha$jr3@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,45b074eb17fcf6c3 X-Google-Attributes: gidf74b3,public From: <nlaan> Subject: Re: How to handle Frame location? Date: 1999/08/18 Message-ID: <7pemhm$27i12@forums.borland.com> X-Deja-AN: 514264302 References: <7pd2ha$jr3@forums.borland.com> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language