< prev index next >
test/jdk/java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java
Print this page
*** 20,72 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! * test
! * @bug 6497426
! * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols
! * @author Yuri.Nesterenko@... area=awt.keyboard
! * @run applet CtrlASCII.html
*/
- // Note there is no @ in front of test above. This is so that the
- // harness will not mistake this file as a test file. It should
- // only see the html file as a test file. (the harness runs all
- // valid test files, so it would run this test twice if this file
- // were valid as well as the html file.)
- // Also, note the area= after Your Name in the author tag. Here, you
- // should put which functional area the test falls in. See the
- // AWT-core home page -> test areas and/or -> AWT team for a list of
- // areas.
- // Note also the 'RobotLWTest.html' in the run tag. This should
- // be changed to the name of the test.
-
-
- /**
- * CtrlASCII.java
- *
- * @summary Tests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols
- */
-
- import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
-
//
// In this test, a key listener for KEY_TYPED checks if a character typed has
// a correspondent keycode in an initially filled hashtable.
// If it does not, test fails. If character was produced by
// pressing a wrong key still listed in the hashtable, test cannot detect it.
// Under MS Windows, unlike X Window, some Ctrl+Ascii keystrokes don't
// produce a unicode character, so there will be no KEY_TYPED and no problem.
// Test doesn't try to verify Ctrl+deadkey behavior.
//
!
! public class CtrlASCII extends Applet implements KeyListener
{
// Declare things used in the test, like buttons and labels here
static Hashtable<Character, Integer> keycharHash = new Hashtable<Character, Integer>();
static boolean testFailed = false;
//Frame frame;
--- 20,50 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! @test
! @key headful
! @bug 6497426
! @summary ests that pressing of Ctrl+ascii mostly fires KEY_TYPED with a Unicode control symbols
! @run main CtrlASCII
*/
import java.awt.*;
import java.awt.event.*;
import java.util.*;
//
// In this test, a key listener for KEY_TYPED checks if a character typed has
// a correspondent keycode in an initially filled hashtable.
// If it does not, test fails. If character was produced by
// pressing a wrong key still listed in the hashtable, test cannot detect it.
// Under MS Windows, unlike X Window, some Ctrl+Ascii keystrokes don't
// produce a unicode character, so there will be no KEY_TYPED and no problem.
// Test doesn't try to verify Ctrl+deadkey behavior.
//
! public class CtrlASCII extends Frame implements KeyListener
{
// Declare things used in the test, like buttons and labels here
static Hashtable<Character, Integer> keycharHash = new Hashtable<Character, Integer>();
static boolean testFailed = false;
//Frame frame;
*** 192,201 ****
--- 170,180 ----
}//End init()
public void start ()
{
setSize(400,300);
+ setLocationRelativeTo(null);
setVisible(true);
String original = "0123456789";
tf = new TextField(original, 20);
this.add(tf);
< prev index next >