modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
Print this page
@@ -206,15 +206,10 @@
}
// Initialize FX runtime when the JFXPanel instance is constructed
private synchronized static void initFx() {
// Note that calling PlatformImpl.startup more than once is OK
- AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
- System.setProperty("glass.win.uiScale", "100%");
- System.setProperty("glass.win.renderScale", "100%");
- return null;
- });
PlatformImpl.startup(() -> {
// No need to do anything here
});
}
@@ -681,10 +676,13 @@
if (scenePeer == null) {
return;
}
if (pixelsIm == null) {
createResizePixelBuffer(scaleFactor);
+ if (pixelsIm == null) {
+ return;
+ }
}
DataBufferInt dataBuf = (DataBufferInt)pixelsIm.getRaster().getDataBuffer();
int[] pixelsData = dataBuf.getData();
IntBuffer buf = IntBuffer.wrap(pixelsData);
if (!scenePeer.getPixels(buf, pWidth, pHeight)) {
@@ -710,11 +708,11 @@
newScaleFactor = getDefaultScale(((SunGraphics2D)g).surfaceData);
}
if (scaleFactor != newScaleFactor) {
createResizePixelBuffer(newScaleFactor);
// The scene will request repaint.
- scenePeer.setPixelScaleFactor(newScaleFactor);
+ scenePeer.setPixelScaleFactors(newScaleFactor, newScaleFactor);
scaleFactor = newScaleFactor;
}
} catch (Throwable th) {
th.printStackTrace();
} finally {
@@ -904,11 +902,11 @@
return;
}
if (pWidth > 0 && pHeight > 0) {
scenePeer.setSize(pWidth, pHeight);
}
- scenePeer.setPixelScaleFactor(scaleFactor);
+ scenePeer.setPixelScaleFactors(scaleFactor, scaleFactor);
invokeOnClientEDT(() -> {
dnd = new SwingDnD(JFXPanel.this, scenePeer);
dnd.addNotify();
if (scenePeer != null) {