< prev index next >

test/javax/swing/JInternalFrame/6726866/bug6726866.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2009, 2013, 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) 2009, 2017, 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.
*** 20,38 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test ! @bug 6726866 ! @summary Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel ! @author Alexander Potochkin @run applet/manual=yesno bug6726866.html */ ! import javax.swing.*; ! import java.awt.*; ! import java.lang.reflect.Method; public class bug6726866 extends JApplet { public void init() { JFrame frame = new JFrame("bug6726866"); --- 20,43 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test ! @bug 6726866 8186617 ! @summary Repainting artifacts when resizing or dragging JInternalFrames in ! non-opaque toplevel @run applet/manual=yesno bug6726866.html */ ! import java.awt.Color; ! import java.awt.Window; ! ! import javax.swing.JApplet; ! import javax.swing.JDesktopPane; ! import javax.swing.JFrame; ! import javax.swing.JInternalFrame; ! import javax.swing.JLabel; public class bug6726866 extends JApplet { public void init() { JFrame frame = new JFrame("bug6726866");
*** 52,67 **** frame.setSize(400, 400); frame.setVisible(true); frame.toFront(); } ! private void setWindowNonOpaque(Window w) { ! try { ! Class<?> c = Class.forName("com.sun.awt.AWTUtilities"); ! Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class); ! m.invoke(null, w, false); ! } ! catch (Exception e) { ! e.printStackTrace(); } } } --- 57,70 ---- frame.setSize(400, 400); frame.setVisible(true); frame.toFront(); } ! public static void setWindowNonOpaque(Window window) { ! Color bg = window.getBackground(); ! if (bg == null) { ! bg = new Color(0, 0, 0, 0); } + window.setBackground( + new Color(bg.getRed(), bg.getGreen(), bg.getBlue(), 0)); } }
< prev index next >