mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-15 10:23:28 +00:00
8244400: MenuItem may cache the size and did not update it when the screen DPI is changed
Reviewed-by: serb, aivanov
This commit is contained in:
parent
836198a400
commit
11aadc9d98
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1160,6 +1160,9 @@ public class BasicMenuItemUI extends MenuItemUI
|
||||
// existed, and install a new one if the text installed
|
||||
// into the JLabel is html source.
|
||||
JMenuItem lbl = ((JMenuItem) e.getSource());
|
||||
if (SwingUtilities2.isScaleChanged(e)) {
|
||||
MenuItemLayoutHelper.clearUsedParentClientProperties(lbl);
|
||||
}
|
||||
String text = lbl.getText();
|
||||
BasicHTML.updateRenderer(lbl, text);
|
||||
} else if (name == "iconTextGap") {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,22 +56,19 @@ import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import sun.swing.MenuItemLayoutHelper;
|
||||
|
||||
import static javax.swing.UIManager.getInstalledLookAndFeels;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 8201552 8213843 8213535
|
||||
* @bug 8201552 8213843 8213535 8244400
|
||||
* @summary Initial layout of the component should use correct graphics config.
|
||||
* It is checked by SwingUtilities.updateComponentTreeUI(), if layout
|
||||
* was correct the call to updateComponentTreeUI() will be no-op.
|
||||
* @modules java.desktop/sun.swing
|
||||
* @compile -encoding utf-8 StalePreferredSize.java
|
||||
* @run main/othervm/timeout=400 StalePreferredSize
|
||||
* @run main/othervm/timeout=400 -Dsun.java2d.uiScale=1 StalePreferredSize
|
||||
* @run main/othervm/timeout=400 -Dsun.java2d.uiScale=2.25 StalePreferredSize
|
||||
* @run main/othervm/timeout=600 StalePreferredSize
|
||||
* @run main/othervm/timeout=600 -Dsun.java2d.uiScale=1 StalePreferredSize
|
||||
* @run main/othervm/timeout=600 -Dsun.java2d.uiScale=2.25 StalePreferredSize
|
||||
*/
|
||||
public final class StalePreferredSize {
|
||||
|
||||
@ -182,10 +179,6 @@ public final class StalePreferredSize {
|
||||
int y = frame.getY() + 200;
|
||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||
popup = factory.getPopup(frame, component, x, y);
|
||||
if (component instanceof JMenuItem) {
|
||||
// TODO JDK-8244400
|
||||
MenuItemLayoutHelper.clearUsedParentClientProperties((JMenuItem)component);
|
||||
}
|
||||
} else {
|
||||
frame.add(new JScrollPane(component));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user