< prev index next >
test/jdk/java/awt/Toolkit/Headless/AWTEventListener/AWTListener.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2008, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2008, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 46,71 ****
AWTEventListener orig = new AWTEventListener() {
public void eventDispatched(AWTEvent event) { }
};
! Sysout.println("Test: listener to add = " +orig);
toolkit.addAWTEventListener(orig, AWTEvent.CONTAINER_EVENT_MASK);
for (AWTEventListener l: toolkit.getAWTEventListeners()){
! Sysout.println("Test: listener = " +l+" ");
}
if ( toolkit.getAWTEventListeners().length == 0 ) {
throw new RuntimeException("Case 1. An empty array returned unexpectedly");
}
for (AWTEventListener l: toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK)){
! Sysout.println("Test: listener = " +l);
}
if ( toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK).length == 0 ) {
throw new RuntimeException("Case 2. An empty array returned unexpectedly");
}
! Sysout.println("Test PASSED");
}
}
--- 46,71 ----
AWTEventListener orig = new AWTEventListener() {
public void eventDispatched(AWTEvent event) { }
};
! System.out.println("Test: listener to add = " +orig);
toolkit.addAWTEventListener(orig, AWTEvent.CONTAINER_EVENT_MASK);
for (AWTEventListener l: toolkit.getAWTEventListeners()){
! System.out.println("Test: listener = " +l+" ");
}
if ( toolkit.getAWTEventListeners().length == 0 ) {
throw new RuntimeException("Case 1. An empty array returned unexpectedly");
}
for (AWTEventListener l: toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK)){
! System.out.println("Test: listener = " +l);
}
if ( toolkit.getAWTEventListeners(AWTEvent.CONTAINER_EVENT_MASK).length == 0 ) {
throw new RuntimeException("Case 2. An empty array returned unexpectedly");
}
! System.out.println("Test PASSED");
}
}
< prev index next >