< prev index next >
test/jdk/javax/swing/text/StyledEditorKit/4506788/bug4506788.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2012, 2016, Oracle and/or its affiliates. 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.
--- 1,7 ----
/*
! * Copyright (c) 2012, 2018, Oracle and/or its affiliates. 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.
*** 24,50 ****
/*
* @test
* @key headful
* @bug 4506788 7147408
* @summary Tests if cursor gets stuck after insertion a character
! * @author Denis Sharypov
! * @run applet bug4506788.html
*/
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.InvocationTargetException;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
! public class bug4506788 extends JApplet {
private volatile boolean passed = false;
private JEditorPane jep;
! @Override
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
--- 24,54 ----
/*
* @test
* @key headful
* @bug 4506788 7147408
* @summary Tests if cursor gets stuck after insertion a character
! * @run main bug4506788
*/
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.InvocationTargetException;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
! public class bug4506788 {
private volatile boolean passed = false;
private JEditorPane jep;
! public static void main(final String[] args) {
! bug4506788 app = new bug4506788();
! app.init();
! app.start();
! }
!
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
*** 55,65 ****
ex.printStackTrace();
throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI");
}
}
- @Override
public void start() {
Robot robot;
try {
robot = new Robot();
} catch (AWTException e) {
--- 59,68 ----
*** 127,134 ****
--- 130,138 ----
StyleConstants.setBold(atr, true);
doc.setCharacterAttributes(1, 1, atr, false);
f.getContentPane().add(jep);
f.setSize(100, 100);
+ f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
< prev index next >