jdk/src/share/classes/java/awt/Container.java
Print this page
@@ -159,11 +159,11 @@
* @see #setFocusTraversalPolicyProvider
*/
private boolean focusTraversalPolicyProvider;
// keeps track of the threads that are printing this component
- private transient Set printingThreads;
+ private transient Set<Thread> printingThreads;
// True if there is at least one thread that's printing this component
private transient boolean printing = false;
transient ContainerListener containerListener;
@@ -273,11 +273,11 @@
* somewhere higher up in the component tree that is native.
* (such as Frame for example).
*/
public Container() {
}
-
+ @SuppressWarnings({"unchecked","rawtypes"})
void initializeFocusTraversalKeys() {
focusTraversalKeys = new Set[4];
}
/**
@@ -2004,11 +2004,11 @@
if (isShowing()) {
Thread t = Thread.currentThread();
try {
synchronized (getObjectLock()) {
if (printingThreads == null) {
- printingThreads = new HashSet();
+ printingThreads = new HashSet<>();
}
printingThreads.add(t);
printing = true;
}
super.print(g); // By default, Component.print() calls paint()
@@ -2146,11 +2146,11 @@
* @see #addContainerListener
* @see #removeContainerListener
* @since 1.4
*/
public synchronized ContainerListener[] getContainerListeners() {
- return (ContainerListener[]) (getListeners(ContainerListener.class));
+ return getListeners(ContainerListener.class);
}
/**
* Returns an array of all the objects currently registered
* as <code><em>Foo</em>Listener</code>s
@@ -2597,13 +2597,13 @@
*/
public Point getMousePosition(boolean allowChildren) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
- PointerInfo pi = (PointerInfo)java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ PointerInfo pi = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<PointerInfo>() {
+ public PointerInfo run() {
return MouseInfo.getPointerInfo();
}
}
);
synchronized (getTreeLock()) {
@@ -2680,11 +2680,11 @@
if (comp instanceof Container) {
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
y - comp.y,
ignoreEnabled);
} else {
- comp = comp.locate(x - comp.x, y - comp.y);
+ comp = comp.getComponentAt(x - comp.x, y - comp.y);
}
if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled))
{
return comp;
@@ -2698,11 +2698,11 @@
if (comp instanceof Container) {
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
y - comp.y,
ignoreEnabled);
} else {
- comp = comp.locate(x - comp.x, y - comp.y);
+ comp = comp.getComponentAt(x - comp.x, y - comp.y);
}
if (comp != null && comp.visible &&
(ignoreEnabled || comp.enabled))
{
return comp;
@@ -4635,11 +4635,11 @@
* events in this container
*/
private void startListeningForOtherDrags() {
//System.out.println("Adding AWTEventListener");
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
nativeContainer.getToolkit().addAWTEventListener(
LightweightDispatcher.this,
AWTEvent.MOUSE_EVENT_MASK |
AWTEvent.MOUSE_MOTION_EVENT_MASK);
@@ -4650,11 +4650,11 @@
}
private void stopListeningForOtherDrags() {
//System.out.println("Removing AWTEventListener");
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
nativeContainer.getToolkit().removeAWTEventListener(LightweightDispatcher.this);
return null;
}
}