Understanding the com.sun.* APIs being (ab)used by the community
Dr. Michael Paus
mp at jugs.org
Fri Jun 5 09:18:08 UTC 2015
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