Are you using Windows? This sounds like the kind of value it returns. This
is controlled, strangely enough, by the Font Size setting in the Display
control panel. 96dpi corresponds to 'Small' fonts or 100% scaling. If you
choose 'Large' fonts (or 125% scaling), you get 120dpi. You can also choose
intermediate values.
Java2D doesn't seem to use this information internally though. The default
transform for screen Graphics is the identity transform, and the device
resolution is assumed to be 72dpi (i.e. one pixel ~ one point). This means
that as screen DPIs goes up, objects drawn by Java2D get smaller,
instead of staying the same size, even if the device DPI is reflected in the
system
settings. I guess you could fix this up by doing
d.scale(resolution /72.0f, resolution /72.0f);
(or maybe use 96.0f, as that's Windows' default), but then you'd have to
watch out for printing.
Cheers,
Pete
--
Pete Cockerell
California, USA
----- Original Message -----
From: John Sproull <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 11, 1999 5:50 AM
Subject: [java2d] getScreenResolution
>
> Hi, all.. this may have been dealt with before, so forgive me if you've
> heard this.. I'm trying to get the screenresolution (in dpi) of the
> current user's screen. We're working with map information so converting
> milimeters in the map to a proper mapping scale is tough when
> getScreenResolution() always returns 96. :) here's what i'm using:
>
> Toolkit defaultToolKit = Toolkit.getDefaultToolkit();
> int resolution = defaultToolKit.getScreenResolution();
>
> anyone know a solution to this? thanks!
>
> John Sproull
> Universal Systems, Ltd.
> Fredericton, NB
>
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/
>
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/