8213843: Changing L&F from Nimbus to Window L&F causes NPE in SwingSet2

8213121: javax/swing/GraphicsConfigNotifier/StalePreferredSize.java fails on mac10.13

Reviewed-by: serb
This commit is contained in:
Prasanta Sadhukhan 2018-11-27 10:45:54 +05:30
parent 01267bb7ca
commit a51bf4d7e6
3 changed files with 10 additions and 12 deletions
src/java.desktop/share/classes/javax/swing/plaf/synth
test/jdk
ProblemList.txt
javax/swing/GraphicsConfigNotifier

@ -55,14 +55,7 @@ public class SynthButtonUI extends BasicButtonUI implements
* @return the UI object
*/
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
SynthButtonUI synthButtonUI =
(SynthButtonUI) appContext.get(SYNTH_BUTTON_UI_KEY);
if (synthButtonUI == null) {
synthButtonUI = new SynthButtonUI();
appContext.put(SYNTH_BUTTON_UI_KEY, synthButtonUI);
}
return synthButtonUI;
return new SynthButtonUI();
}
/**
@ -216,9 +209,15 @@ public class SynthButtonUI extends BasicButtonUI implements
// layout the text and icon
SynthContext context = getContext(b);
SynthStyle style;
if (context.getStyle() != null) {
style = context.getStyle();
} else {
style = SynthLookAndFeel.updateStyle(context, this);
}
FontMetrics fm = context.getComponent().getFontMetrics(
context.getStyle().getFont(context));
context.getStyle().getGraphicsUtils(context).layoutText(
style.getFont(context));
style.getGraphicsUtils(context).layoutText(
context, fm, b.getText(), b.getIcon(),
b.getHorizontalAlignment(), b.getVerticalAlignment(),
b.getHorizontalTextPosition(), b.getVerticalTextPosition(),

@ -815,7 +815,6 @@ javax/swing/JPopupMenu/8075063/ContextMenuScrollTest.java 202880 linux-all
javax/swing/JPopupMenu/6583251/bug6583251.java 8213564 linux-all
javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765 macosx-all,linux-all
javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
javax/swing/GraphicsConfigNotifier/StalePreferredSize.java 8213121 macosx-all,linux-all
javax/swing/JButton/4368790/bug4368790.java 8213123 macosx-all
javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all
javax/swing/JTable/6263446/bug6263446.java 8169959 macosx-all

@ -59,7 +59,7 @@ import static javax.swing.UIManager.getInstalledLookAndFeels;
/**
* @test
* @key headful
* @bug 8201552
* @bug 8201552 8213843
* @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.