/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 6607170
@summary Tests for focus-auto-transfer.
@author Anton Tarasov: area=awt-focus
@library ../../regtesthelpers
@build Util
@run main ContainerFocusAutoTransferTest
*/
enum TestCase {
};
}
public void init() {
}
}
public void start() {
test4();
}
showFrame();
test1(t); // Test for correct auto-transfer
test2(t); // Test for clearing focus
}
public void run() {
}
}
};
throw new TestFailedException(t + ": focus wasn't transfered as expected!");
}
}
}
throw new TestFailedException(t + ": focus wasn't cleared!");
}
}
showFrame();
public void run() {
} else if (t == TestCase.DEFOCUSING) {
}
}};
throw new TestFailedException(t + ": focus wasn't transfered as expected!");
}
}
void test4() {
showFrame();
frame.setFocusableWindowState(false);
throw new TestFailedException("defocusing the frame: focus wasn't cleared!");
}
}
void showFrame() {
}
frame.setVisible(true);
}
}
}
throw new TestFailedException("wrong focus transfer on removal!");
}
}
return super.dispatchEvent(e);
}
}
}
public TestFrame() {
super("TestFrame");
// The change of the orientation and the reverse order of
// adding the buttons to the panel is because in Container.removeNotify()
// the child components are removed in the reverse order.
// We want that the focus owner (b0) would be removed first and
// that the next traversable component would be b1.
setLayout(new FlowLayout());
pack();
}
}
// Thrown when the behavior being verified is found wrong.
super("Test failed: " + msg);
}
}
// Thrown when an error not related to the behavior being verified is encountered.
super("Unexpected error: " + msg);
}
}