mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8376420
This commit is contained in:
parent
12570be64a
commit
08f95226d2
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -54,7 +54,6 @@ import javax.accessibility.AccessibleState;
|
||||
import javax.accessibility.AccessibleStateSet;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
|
||||
/**
|
||||
* An implementation of the Icon interface that paints Icons
|
||||
@ -136,8 +135,6 @@ public class ImageIcon implements Icon, Serializable, Accessible {
|
||||
*/
|
||||
private static int mediaTrackerID;
|
||||
|
||||
private static final Object TRACKER_KEY = new StringBuilder("TRACKER_KEY");
|
||||
|
||||
int width = -1;
|
||||
int height = -1;
|
||||
|
||||
@ -346,24 +343,12 @@ public class ImageIcon implements Icon, Serializable, Accessible {
|
||||
}
|
||||
}
|
||||
|
||||
private static final MediaTracker MEDIA_TRACKER = new MediaTracker(new Component() {});
|
||||
/**
|
||||
* Returns the MediaTracker for the current AppContext, creating a new
|
||||
* MediaTracker if necessary.
|
||||
* Returns the shared MediaTracker.
|
||||
*/
|
||||
private MediaTracker getTracker() {
|
||||
Object trackerObj;
|
||||
AppContext ac = AppContext.getAppContext();
|
||||
// Opt: Only synchronize if trackerObj comes back null?
|
||||
// If null, synchronize, re-check for null, and put new tracker
|
||||
synchronized(ac) {
|
||||
trackerObj = ac.get(TRACKER_KEY);
|
||||
if (trackerObj == null) {
|
||||
Component comp = new Component() {};
|
||||
trackerObj = new MediaTracker(comp);
|
||||
ac.put(TRACKER_KEY, trackerObj);
|
||||
}
|
||||
}
|
||||
return (MediaTracker) trackerObj;
|
||||
return MEDIA_TRACKER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user