Initial load
diff --git a/test/java/awt/im/4490692/bug4490692.html b/test/java/awt/im/4490692/bug4490692.html
new file mode 100644
index 0000000..9be8056
--- /dev/null
+++ b/test/java/awt/im/4490692/bug4490692.html
@@ -0,0 +1,40 @@
+<html>
+<!--
+ @test
+ @bug 4490692
+ @author Naoto Sato
+ @ignore The fix for this problem was backed out for 5057184. Remove this "ignore" tag when it is fixed again.
+ @run applet/manual=yesno bug4490692.html
+-->
+ <head>
+ <title>Test for KEY_PRESS event for accented characters</title>
+ </head>
+
+ <body>
+ <h1>Test for KEY_PRESS event for accented characters: Bug id 4490692</h1>
+
+This test is for unix platforms only. Press OK if you are not
+testing on those platforms.
+
+Before the test, you need to modify the keyboard mapping for X by issueing
+the following command:
+
+xmodmap -e 'keycode 60 = aacute' (this is for Solaris Sparc keyboard)
+xmodmap -e 'keycode 23 = aacute' (this is for Linux PC keyboard)
+
+This command lets you type 'a with acute' character when you press 'Tab' keytop. <b>Please
+do not fail to restore the original key mapping by doing the following after the test</b>
+
+xmodmap -e 'keycode 60 = Tab' (this is for Solaris Sparc keyboard)
+xmodmap -e 'keycode 23 = Tab' (this is for Linux PC keyboard)
+
+Confirm the following two behaviors:
+
+ "KEYPRESS received for aacute" is displayed when you press 'Tab' keytop.
+ On Solaris Sparc keyboard, The key sequence ("Compose", "a", "'") generates a-acute character in en_US locale
+
+<APPLET CODE="bug4490692.class" WIDTH=0 HEIGHT=0></APPLET>
+</body>
+</html>
+
+
diff --git a/test/java/awt/im/4490692/bug4490692.java b/test/java/awt/im/4490692/bug4490692.java
new file mode 100644
index 0000000..eec1268
--- /dev/null
+++ b/test/java/awt/im/4490692/bug4490692.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ *
+ * @bug 4490692
+ * @author Naoto Sato
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class bug4490692 extends javax.swing.JApplet {
+ public void init() {
+ new TestFrame();
+ }
+}
+
+class TestFrame extends JFrame implements KeyListener {
+ JTextField text;
+ JLabel label;
+
+ TestFrame () {
+ text = new JTextField();
+ text.addKeyListener(this);
+ label = new JLabel(" ");
+ Container c = getContentPane();
+ BorderLayout borderLayout1 = new BorderLayout();
+ c.setLayout(borderLayout1);
+ c.add(text, BorderLayout.CENTER);
+ c.add(label, BorderLayout.SOUTH);
+ setSize(300, 200);
+ setVisible(true);
+ }
+
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyChar() == 0x00e1) {
+ label.setText("KEYPRESS received for aacute");
+ } else {
+ label.setText(" ");
+ }
+ }
+
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+}
diff --git a/test/java/awt/im/4959409/bug4959409.html b/test/java/awt/im/4959409/bug4959409.html
new file mode 100644
index 0000000..1b98207
--- /dev/null
+++ b/test/java/awt/im/4959409/bug4959409.html
@@ -0,0 +1,26 @@
+<html>
+<!--
+ @test
+ @bug 4959409
+ @author Naoto Sato
+ @run applet/manual=yesno bug4959409.html
+-->
+ <head>
+ <title>Test for </title>
+ </head>
+
+ <body>
+ <h1>Test for KEY_PRESS event for Shift+1: Bug id 4959409</h1>
+
+This test is for unix platforms only. Press Pass if you are not
+testing on those platforms.
+
+Confirm the following behavior:
+
+ "KEYPRESS received for Shift+1" is displayed when you press "Shift" and "1" (typically "!").
+
+<APPLET CODE="bug4959409.class" WIDTH=0 HEIGHT=0></APPLET>
+</body>
+</html>
+
+
diff --git a/test/java/awt/im/4959409/bug4959409.java b/test/java/awt/im/4959409/bug4959409.java
new file mode 100644
index 0000000..5cc3f27
--- /dev/null
+++ b/test/java/awt/im/4959409/bug4959409.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ *
+ * @bug 4959409
+ * @author Naoto Sato
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class bug4959409 extends javax.swing.JApplet {
+ public void init() {
+ new TestFrame();
+ }
+}
+
+class TestFrame extends JFrame implements KeyListener {
+ JTextField text;
+ JLabel label;
+
+ TestFrame () {
+ text = new JTextField();
+ text.addKeyListener(this);
+ label = new JLabel(" ");
+ Container c = getContentPane();
+ BorderLayout borderLayout1 = new BorderLayout();
+ c.setLayout(borderLayout1);
+ c.add(text, BorderLayout.CENTER);
+ c.add(label, BorderLayout.SOUTH);
+ setSize(300, 200);
+ setVisible(true);
+ }
+
+ public void keyPressed(KeyEvent e) {
+ int code = e.getKeyCode();
+ int mods = e.getModifiers();
+ if (code == '1' && mods == KeyEvent.SHIFT_MASK) {
+ label.setText("KEYPRESS received for Shift+1");
+ } else {
+ label.setText(" ");
+ }
+ }
+
+ public void keyTyped(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+}
diff --git a/test/java/awt/im/6396526/IMLookAndFeel.java b/test/java/awt/im/6396526/IMLookAndFeel.java
new file mode 100644
index 0000000..48cc47e
--- /dev/null
+++ b/test/java/awt/im/6396526/IMLookAndFeel.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6396526
+ * @summary Verify below-the-spot IM in the swing L&F JFrame.
+ * Although the swing component is decorated with L&F
+ * the IM window should have no decoration.
+ * @author yuriko.yamasaki
+ */
+
+import java.awt.*;
+import javax.swing.*;
+
+public class IMLookAndFeel {
+ /**
+ * Create the GUI and show it. For thread safety,
+ * this method should be invoked from the
+ * event-dispatching thread.
+ */
+ private static void createAndShowGUI() {
+ //Suggest that the L&F (rather than the system)
+ //decorate all windows. This must be invoked before
+ //creating the JFrame. Native look and feels will
+ //ignore this hint.
+ //Create and set up the window.
+
+ JFrame.setDefaultLookAndFeelDecorated(true);
+ JFrame frame = new JFrame("IM with L&F");
+ //frame.setUndecorated( true );
+
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ JTextArea description = new JTextArea("Please try typing using below-the-spot IM.\n\n eg. Use City IM with the following arguement:\n -Djava.awt.im.style=below-the-spot");
+ description.setPreferredSize(new Dimension(250, 70));
+ description.setEditable(false);
+ frame.getContentPane().add(description, BorderLayout.NORTH);
+
+ JTextField textField = new JTextField();
+ textField.setPreferredSize(new Dimension(275, 50));
+ frame.getContentPane().add(textField, BorderLayout.CENTER);
+
+ //Display the window.
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ public static void main(String[] args) {
+ //Schedule a job for the event-dispatching thread:
+ //creating and showing this application's GUI.
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ }
+}
diff --git a/test/java/awt/im/InputContext/InputContextTest.java b/test/java/awt/im/InputContext/InputContextTest.java
new file mode 100644
index 0000000..ee5b271
--- /dev/null
+++ b/test/java/awt/im/InputContext/InputContextTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 4151222
+ * @bug 4150206
+ * @bug 4243948
+ * @summary removeNotify(null) and selectInputMethod(null) have to
+ * throw a NullPointerException. selectInputMethod doesn't throw a
+ * NullPointerException.
+ */
+
+import java.awt.Frame;
+import java.awt.im.InputContext;
+import java.util.Locale;
+
+public class InputContextTest {
+
+ public static void main(String[] args) throws Exception {
+
+ Frame frame = new Frame();
+ InputContext ic = frame.getInputContext();
+
+ // 4151222
+ try {
+ ic.removeNotify(null);
+ throw new Exception("InputContext.removeNotify(null) doesn't throw NullPointerException");
+ } catch (Exception e) {
+ if (! (e instanceof NullPointerException)) {
+ throw new Exception("InputContext.removeNotify(null) throws " + e
+ + " instead of NullPointerException.");
+ }
+ }
+
+ // 4150206
+ try {
+ ic.selectInputMethod(null);
+ throw new Exception("InputContext.selectInputMethod(null) doesn't throw NullPointerException");
+ } catch (Exception e) {
+ if (! (e instanceof NullPointerException)) {
+ throw new Exception("InputContext.selectInputMethod(null) throws " + e
+ + " instead of NullPointerException.");
+ }
+ }
+
+ // 4243948
+ try {
+ ic.selectInputMethod(Locale.JAPANESE);
+ } catch (Exception e) {
+ throw new Exception("InputContext.selectInputMethod(Locale) throws " + e);
+ }
+ }
+}
diff --git a/test/java/awt/im/InputContext/bug4625203.java b/test/java/awt/im/InputContext/bug4625203.java
new file mode 100644
index 0000000..41c61b8
--- /dev/null
+++ b/test/java/awt/im/InputContext/bug4625203.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4625203
+ * @summary 1. install two input locales on Windows
+ * 2. run this application
+ * 3. press Alt+Shift to switch to another input locale
+ * 4. push jButton1 button
+ * 5. If the input locale does not change, it is SUCCESS.
+ * If the input locale changes to the default one, it is FAILURE.
+ */
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+
+public class bug4625203 extends JFrame {
+ JTextField jTextField1 = new JTextField();
+ JButton jButton1 = new JButton();
+ java.util.Locale locale;
+ public int n = 0;
+
+ public bug4625203() {
+ try {
+ jbInit();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ bug4625203 frame1 = new bug4625203();
+ frame1.setSize(400,300);
+ frame1.setVisible(true);
+ }
+
+ private void jbInit() throws Exception {
+ jTextField1.setText("jTextField1");
+ jButton1.setText("jButton1");
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ jButton1_actionPerformed(e);
+ }
+ });
+ this.addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ this_windowClosing(e);
+ }
+ });
+ this.getContentPane().add(jTextField1, BorderLayout.CENTER);
+ this.getContentPane().add(jButton1, BorderLayout.SOUTH);
+ }
+
+ void jButton1_actionPerformed(ActionEvent e) {
+ locale = ((JButton) e.getSource()).getInputContext().getLocale();
+ System.out.println("locale" + n + ":" + locale.toString());
+ bug4625203 frame2 = new bug4625203();
+ frame2.n = n + 1;
+ frame2.setSize(400,300);
+ frame2.setTitle("test:" +n);
+ frame2.setVisible(true);
+ }
+
+ void this_windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+}
diff --git a/test/java/awt/im/JTextFieldTest.html b/test/java/awt/im/JTextFieldTest.html
new file mode 100644
index 0000000..1b961f7
--- /dev/null
+++ b/test/java/awt/im/JTextFieldTest.html
@@ -0,0 +1,6 @@
+<!---->
+<p>
+Please run this test case under Solaris cjk locale with inputmethod
+support, if you could input Chinese/Japanese/Korean in the swing
+JTextField, then the test has passed!
+<applet code=JTextFieldTest.class width=400 height=400></applet>
diff --git a/test/java/awt/im/JTextFieldTest.java b/test/java/awt/im/JTextFieldTest.java
new file mode 100644
index 0000000..d48b076
--- /dev/null
+++ b/test/java/awt/im/JTextFieldTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4226191
+ * @summary Verify that Lightweight text components (like swing JTextField)
+ * work correctly with IM when there is an uneditable peered
+ * TextField/TextArea in the same parent Frame
+ * @author xueming.shen@eng
+ * @run applet/manual=yesno JTextFieldTest.html
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.*;
+import javax.swing.*;
+
+public class JTextFieldTest extends Applet implements ActionListener {
+
+ TextField tf1;
+ JTextField tf2;
+
+ public JTextFieldTest() {
+ tf1 = new TextField("ABCDEFGH", 10);
+ tf1.setEditable(false);
+ tf2 = new JTextField("12345678", 10);
+ setLayout(new FlowLayout());
+ add(tf1);
+ add(tf2);
+ }
+
+ public void actionPerformed(ActionEvent ae) {
+
+ }
+
+ public static void main(String args[]) {
+ JFrame win = new JFrame();
+ JTextFieldTest jtf = new JTextFieldTest();
+ win.getContentPane().setLayout(new FlowLayout());
+ win.getContentPane().add(jtf);
+ win.pack();
+ win.show();
+ }
+}