| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Sat, 16 Nov 2002 10:50:28 -0600 Robert Westlund <email@hidden> wrote:_______________________________________________
What is the proper (cross-platform safe) way to get the *available*
screen size for a full-screen window?
The toolkit getScreenSize() method returns the full screen resolution
on OS X, whereas the actual available height for a full-screen frame is
about 22 pixels less than that, due to the menubar. Do I need to make
a JDirect or JNI call if my app is running on a Mac, or is there a
simple Java method or system property I can use?
You have to account for the frame's insets:
// Adjust frame dimensions for system-dependent menus/windows
Insets insets = this.getInsets();
width -= (insets.left + insets.right );
height -= (insets.top + insets.bottom);
You can simulate other platforms by overriding getInsets():
public Insets getInsets ()
{
// OverRide getInsets() method to specify desired padding.
// This app:
// return new Insets(9, 9, 9, 9); // top, left, bottom, right
// Windows:
return new Insets(41, 3, 20, 3);
// Macintosh:
// return new Insets(22, 0, 0, 0);
}
- Craig
| References: | |
| >Re: Screen Size Question (From: Craig Mattocks <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.