|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
23 | 23 |
|
24 | 24 | /*
|
25 | 25 | * @test
|
26 |
| - * @bug 4226191 |
| 26 | + * @bug 4226191 |
| 27 | + * @library /java/awt/regtesthelpers |
| 28 | + * @build PassFailJFrame |
27 | 29 | * @summary Verify that Lightweight text components (like swing JTextField)
|
28 | 30 | * work correctly with IM when there is an uneditable peered
|
29 | 31 | * TextField/TextArea in the same parent Frame
|
30 |
| - * @author xueming.shen@eng |
31 |
| - * @run applet/manual=yesno JTextFieldTest.html |
| 32 | + * @run main/manual JTextFieldTest |
32 | 33 | */
|
33 | 34 |
|
34 |
| -import java.awt.*; |
35 |
| -import java.awt.event.*; |
36 |
| -import java.applet.*; |
37 |
| -import javax.swing.*; |
| 35 | +import java.awt.FlowLayout; |
| 36 | +import java.awt.TextField; |
38 | 37 |
|
39 |
| -public class JTextFieldTest extends Applet implements ActionListener { |
| 38 | +import javax.swing.JFrame; |
| 39 | +import javax.swing.JTextField; |
40 | 40 |
|
41 |
| - TextField tf1; |
42 |
| - JTextField tf2; |
| 41 | +public class JTextFieldTest { |
| 42 | + private static final String INSTRUCTIONS = |
| 43 | + """ |
| 44 | + Please run this test in a CJK (Chinese/Japanese/Korean) locale |
| 45 | + with input method support. If you could add input in the swing |
| 46 | + JTextField, then the test has passed! |
| 47 | + """; |
43 | 48 |
|
44 |
| - public JTextFieldTest() { |
45 |
| - tf1 = new TextField("ABCDEFGH", 10); |
46 |
| - tf1.setEditable(false); |
47 |
| - tf2 = new JTextField("12345678", 10); |
48 |
| - setLayout(new FlowLayout()); |
49 |
| - add(tf1); |
50 |
| - add(tf2); |
| 49 | + public static void main(String[] args) throws Exception { |
| 50 | + PassFailJFrame |
| 51 | + .builder() |
| 52 | + .title("JTextFieldTest") |
| 53 | + .instructions(INSTRUCTIONS) |
| 54 | + .rows(5) |
| 55 | + .columns(40) |
| 56 | + .testUI(JTextFieldTest::createAndShowGUI) |
| 57 | + .build() |
| 58 | + .awaitAndCheck(); |
51 | 59 | }
|
52 | 60 |
|
53 |
| - public void actionPerformed(ActionEvent ae) { |
54 |
| - |
55 |
| - } |
56 |
| - |
57 |
| - public static void main(String args[]) { |
58 |
| - JFrame win = new JFrame(); |
59 |
| - JTextFieldTest jtf = new JTextFieldTest(); |
60 |
| - win.getContentPane().setLayout(new FlowLayout()); |
61 |
| - win.getContentPane().add(jtf); |
62 |
| - win.pack(); |
63 |
| - win.show(); |
| 61 | + public static JFrame createAndShowGUI() { |
| 62 | + JFrame frame = new JFrame("Test Frame"); |
| 63 | + frame.setLayout(new FlowLayout()); |
| 64 | + TextField tf1 = new TextField("ABCDEFGH", 10); |
| 65 | + tf1.setEditable(false); |
| 66 | + JTextField tf2 = new JTextField("12345678", 10); |
| 67 | + frame.getContentPane().add(tf1); |
| 68 | + frame.getContentPane().add(tf2); |
| 69 | + frame.pack(); |
| 70 | + return frame; |
64 | 71 | }
|
65 | 72 | }
|
5 commit comments
openjdk-notifier[bot] commentedon Mar 21, 2024
Review
Issues
GoeLin commentedon Dec 18, 2024
/backport jdk21u-dev
GoeLin commentedon Dec 18, 2024
/backport jdk17u-dev
openjdk[bot] commentedon Dec 18, 2024
@GoeLin the backport was successfully created on the branch backport-GoeLin-cc5cda55-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:
➡️ Create pull request
The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:
openjdk[bot] commentedon Dec 18, 2024
@GoeLin the backport was successfully created on the branch backport-GoeLin-cc5cda55-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:
➡️ Create pull request
The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev: