bug6726866.java revision 1222
0N/A/* @test
1879N/A @bug 6726866
0N/A @summary Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
0N/A @author Alexander Potochkin
0N/A @run applet/manual=yesno bug6726866.html
0N/A*/
0N/A
0N/Aimport javax.swing.*;
0N/Aimport java.awt.*;
0N/Aimport java.lang.reflect.Method;
0N/A
0N/Apublic class bug6726866 extends JApplet {
0N/A
0N/A public void init() {
0N/A JFrame frame = new JFrame("bug6726866");
0N/A frame.setUndecorated(true);
0N/A setWindowNonOpaque(frame);
0N/A
1472N/A JDesktopPane desktop = new JDesktopPane();
1472N/A desktop.setBackground(Color.GREEN);
1472N/A JInternalFrame iFrame = new JInternalFrame("Test", true, true, true, true);
0N/A iFrame.add(new JLabel("internal Frame"));
0N/A iFrame.setBounds(10, 10, 300, 200);
0N/A iFrame.setVisible(true);
1879N/A desktop.add(iFrame);
1879N/A frame.add(desktop);
1879N/A
1879N/A frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1879N/A frame.setSize(400, 400);
1879N/A frame.setVisible(true);
3767N/A frame.toFront();
1879N/A }
1879N/A
1879N/A private void setWindowNonOpaque(Window w) {
0N/A try {
0N/A Class<?> c = Class.forName("com.sun.awt.AWTUtilities");
0N/A Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class);
0N/A m.invoke(null, w, false);
0N/A }
0N/A catch (Exception e) {
3767N/A e.printStackTrace();
3842N/A }
3842N/A }
3842N/A}
3842N/A