author | mcherkas |
Tue, 30 Apr 2013 13:24:14 +0400 | |
changeset 17149 | adce5338e9b5 |
parent 2808 | a139a919f645 |
child 21596 | 0e3a39f29dbc |
permissions | -rw-r--r-- |
2808
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
1 |
/* @test |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
2 |
@bug 6726866 |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
3 |
@summary Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
4 |
@author Alexander Potochkin |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
5 |
@run applet/manual=yesno bug6726866.html |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
6 |
*/ |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
7 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
8 |
import javax.swing.*; |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
9 |
import java.awt.*; |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
10 |
import java.lang.reflect.Method; |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
11 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
12 |
public class bug6726866 extends JApplet { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
13 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
14 |
public void init() { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
15 |
JFrame frame = new JFrame("bug6726866"); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
16 |
frame.setUndecorated(true); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
17 |
setWindowNonOpaque(frame); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
18 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
19 |
JDesktopPane desktop = new JDesktopPane(); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
20 |
desktop.setBackground(Color.GREEN); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
21 |
JInternalFrame iFrame = new JInternalFrame("Test", true, true, true, true); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
22 |
iFrame.add(new JLabel("internal Frame")); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
23 |
iFrame.setBounds(10, 10, 300, 200); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
24 |
iFrame.setVisible(true); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
25 |
desktop.add(iFrame); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
26 |
frame.add(desktop); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
27 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
28 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
29 |
frame.setSize(400, 400); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
30 |
frame.setVisible(true); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
31 |
frame.toFront(); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
32 |
} |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
33 |
|
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
34 |
private void setWindowNonOpaque(Window w) { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
35 |
try { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
36 |
Class<?> c = Class.forName("com.sun.awt.AWTUtilities"); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
37 |
Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
38 |
m.invoke(null, w, false); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
39 |
} |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
40 |
catch (Exception e) { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
41 |
e.printStackTrace(); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
42 |
} |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
43 |
} |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
diff
changeset
|
44 |
} |