mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
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:
parent
01267bb7ca
commit
a51bf4d7e6
3 changed files with 10 additions and 12 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue