equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @key headful |
26 * @key headful |
27 * @bug 4506788 7147408 |
27 * @bug 4506788 7147408 |
28 * @summary Tests if cursor gets stuck after insertion a character |
28 * @summary Tests if cursor gets stuck after insertion a character |
29 * @author Denis Sharypov |
29 * @run main bug4506788 |
30 * @run applet bug4506788.html |
|
31 */ |
30 */ |
32 |
31 |
33 import java.awt.*; |
32 import java.awt.*; |
34 import java.awt.event.*; |
33 import java.awt.event.*; |
35 import java.lang.reflect.InvocationTargetException; |
34 import java.lang.reflect.InvocationTargetException; |
36 import javax.swing.*; |
35 import javax.swing.*; |
37 import javax.swing.event.*; |
36 import javax.swing.event.*; |
38 import javax.swing.text.*; |
37 import javax.swing.text.*; |
39 |
38 |
40 public class bug4506788 extends JApplet { |
39 public class bug4506788 { |
41 |
40 |
42 private volatile boolean passed = false; |
41 private volatile boolean passed = false; |
43 private JEditorPane jep; |
42 private JEditorPane jep; |
44 |
43 |
45 @Override |
44 public static void main(final String[] args) { |
|
45 bug4506788 app = new bug4506788(); |
|
46 app.init(); |
|
47 app.start(); |
|
48 } |
|
49 |
46 public void init() { |
50 public void init() { |
47 try { |
51 try { |
48 SwingUtilities.invokeAndWait(new Runnable() { |
52 SwingUtilities.invokeAndWait(new Runnable() { |
49 @Override |
53 @Override |
50 public void run() { |
54 public void run() { |
55 ex.printStackTrace(); |
59 ex.printStackTrace(); |
56 throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); |
60 throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); |
57 } |
61 } |
58 } |
62 } |
59 |
63 |
60 @Override |
|
61 public void start() { |
64 public void start() { |
62 Robot robot; |
65 Robot robot; |
63 try { |
66 try { |
64 robot = new Robot(); |
67 robot = new Robot(); |
65 } catch (AWTException e) { |
68 } catch (AWTException e) { |
127 StyleConstants.setBold(atr, true); |
130 StyleConstants.setBold(atr, true); |
128 doc.setCharacterAttributes(1, 1, atr, false); |
131 doc.setCharacterAttributes(1, 1, atr, false); |
129 |
132 |
130 f.getContentPane().add(jep); |
133 f.getContentPane().add(jep); |
131 f.setSize(100, 100); |
134 f.setSize(100, 100); |
|
135 f.setLocationRelativeTo(null); |
132 f.setVisible(true); |
136 f.setVisible(true); |
133 } |
137 } |
134 } |
138 } |