diff --git a/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java b/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java index daab9161991..ae14988382d 100644 --- a/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java +++ b/Ports/JavaSE/src/com/codename1/impl/javase/JavaSEPort.java @@ -278,6 +278,17 @@ public class JavaSEPort extends CodenameOneImplementation { // frame off every reachable display. static final int MAX_PERSISTED_WINDOW_DIMENSION = 32767; + static { + // The canvas blits straight to the screen through getGraphics(), outside + // Swing's paint cycle, so a lightweight popup (painted into the same + // surface) is overwritten wherever it overlaps the canvas and smears + // (#5850). A heavyweight popup lives in its own native window above it. + // Set here, before any frame or menu exists: a JPopupMenu reads the default + // when it is constructed, and the native-chrome menu bars + // (buildNativeMenuBar) are built without installMenu ever running. + JPopupMenu.setDefaultLightWeightPopupEnabled(false); + } + static { IOS_NATIVE_FONT_CANDIDATES.put("native:MainThin", new String[] { "SF Pro Display", "SF Pro Text", @@ -4457,26 +4468,6 @@ public void run() { updateEdtBufferSize(); } - if (window != null) { - - if (zoomLevel != 1) { - Graphics2D g2d = (Graphics2D) g; - g2d.setTransform(AffineTransform.getScaleInstance(1, 1)); - } - - if (window.getJMenuBar() != null) { - for (int i = 0; i < window.getJMenuBar().getComponentCount(); i++) { - JMenu m = (JMenu) window.getJMenuBar().getComponent(i); - if (m.isPopupMenuVisible()) { - JPopupMenu pop = m.getPopupMenu(); - pop.getInvoker().getX(); - g.translate(pop.getInvoker().getX(), 0); - pop.update(g); - g.translate(-pop.getInvoker().getX(), 0); - } - } - } - } g.dispose(); } }