1
1
/*
2
- * Copyright (c) 2011, 2012 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2020 , 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
28
28
* @summary Html content in JEditorPane is overlapping on swing components while resizing the application.
29
29
* @library ../../../regtesthelpers
30
30
* @build Util
31
- @run main bug6796710
31
+ * @run main/othervm -Dsun.java2d.uiScale=1 bug6796710
32
32
*/
33
33
34
- import java .awt .*;
34
+ import java .awt .BorderLayout ;
35
+ import java .awt .Rectangle ;
36
+ import java .awt .Robot ;
35
37
import java .awt .image .BufferedImage ;
36
- import javax .swing .*;
38
+ import java .io .File ;
39
+
40
+ import javax .imageio .ImageIO ;
41
+ import javax .swing .JButton ;
42
+ import javax .swing .JEditorPane ;
43
+ import javax .swing .JFrame ;
44
+ import javax .swing .JLabel ;
45
+ import javax .swing .JPanel ;
46
+ import javax .swing .JScrollPane ;
47
+ import javax .swing .SwingUtilities ;
37
48
38
49
public class bug6796710 {
39
50
// The page is inlined because we want to be sure that the JEditorPane filled synchronously
@@ -89,6 +100,7 @@ public void run() {
89
100
90
101
frame .setContentPane (pnContent );
91
102
frame .setSize (400 , 600 );
103
+ frame .setLocationRelativeTo (null );
92
104
frame .setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
93
105
frame .setVisible (true );
94
106
}
@@ -113,7 +125,10 @@ public void run() {
113
125
// On Linux platforms realSync doesn't guaranties setSize completion
114
126
Thread .sleep (1000 );
115
127
116
- if (!Util .compareBufferedImages (bufferedImage , getPnBottomImage ())) {
128
+ BufferedImage pnBottomImage = getPnBottomImage ();
129
+ if (!Util .compareBufferedImages (bufferedImage , pnBottomImage )) {
130
+ ImageIO .write (bufferedImage , "png" , new File ("bufferedImage.png" ));
131
+ ImageIO .write (pnBottomImage , "png" , new File ("pnBottomImage.png" ));
117
132
throw new RuntimeException ("The test failed" );
118
133
}
119
134
0 commit comments