Understanding the com.sun.* APIs being (ab)used by the community
Dr. Michael Paus
mp at jugs.org
Fri Jun 5 15:37:00 UTC 2015
I promise to ditch that code as soon as there is a viable alternative. :-)
Am 05.06.15 um 17:28 schrieb Kevin Rushforth:
> Yes, this will still work, although dipping into non-public state
> continues to be something we wouldn't recommend that an application
> rely on...
>
> -- Kevin
>
>
> Dr. Michael Paus wrote:
>> As nobody has stated it explicitly so far I would like to ask what
>> will happen
>> to classes in Java9 which access methods that are within the javafx
>> namespace but
>> are declared private? Will code like this still work or not?
>>
>> public static double getPixelScale(Screen screen) throws
>> NoSuchMethodException, SecurityException, IllegalAccessException,
>> IllegalArgumentException, InvocationTargetException {
>> Method m = Screen.class.getDeclaredMethod("getScale");
>> m.setAccessible(true);
>> return ((Float) m.invoke(screen)).doubleValue();
>> }
>>
>> This hack for example is currently necessary because there is no
>> other way to get at
>> the current pixel scale of a HiDPI screen.
>>
>>
>>
More information about the openjfx-dev
mailing list