Details
-
Type:
Bug
-
Status: Open
-
Priority:
P3
-
Resolution: Unresolved
-
Affects Version/s: 10, 11
-
Fix Version/s: tbd
-
Component/s: client-libs
-
Labels:None
-
CPU:generic
-
OS:generic
Description
When the font of the component changes it preferred size should be changed as well(if needed). But some components ignores this rule.
For example JTree.
To reproduce the bug uncomment the "TODO" block in this case and run it:
http://cr.openjdk.java.net/~serb/8201552/webrev.03/test/jdk/javax/swing/GraphicsConfigNotifier/StalePreferredSize.java.html
// We change the font size to some big value, as a result the
// layout and preferredSize of the component should be changed
component.setFont(component.getFont().deriveFont(35f));
Dimension last = component.getPreferredSize();
...........
...........
// TODO JDK-8206024
// if (Objects.equals(after, last)) {
// System.err.println("Component: " + component);
// System.err.println("After: " + after);
// System.err.println("Last: " + last);
// throw new RuntimeException("Wrong PreferredSize");
// }
For example JTree.
To reproduce the bug uncomment the "TODO" block in this case and run it:
http://cr.openjdk.java.net/~serb/8201552/webrev.03/test/jdk/javax/swing/GraphicsConfigNotifier/StalePreferredSize.java.html
// We change the font size to some big value, as a result the
// layout and preferredSize of the component should be changed
component.setFont(component.getFont().deriveFont(35f));
Dimension last = component.getPreferredSize();
...........
...........
// TODO JDK-8206024
// if (Objects.equals(after, last)) {
// System.err.println("Component: " + component);
// System.err.println("After: " + after);
// System.err.println("Last: " + last);
// throw new RuntimeException("Wrong PreferredSize");
// }