Here you can find the source of refreshShape(final JFrame frame)
public static void refreshShape(final JFrame frame)
//package com.java2s; /*/* w ww .ja v a 2s .c o m*/ * : ShapedWindowHelper.java,v 1.1 2007/03/13 15:00:55 pottsj Exp $ * * Copyright 2007 Sun Microsystems, Inc., 4150 Network Circle, * Santa Clara, California 95054, U.S.A. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import javax.swing.JFrame; import java.awt.Graphics2D; import java.awt.Composite; import java.awt.AlphaComposite; public class Main { public static void refreshShape(final JFrame frame) { if (frame != null) { if ("Mac OS X".equals(System.getProperty("os.name"))) { Graphics2D g2 = (Graphics2D) frame.getGraphics(); Composite oldComposite = g2.getComposite(); g2.setComposite(AlphaComposite.Clear); g2.fillRect(0, 0, frame.getWidth(), frame.getHeight()); g2.setComposite(oldComposite); frame.paint(g2); frame.getRootPane().putClientProperty("apple.awt.windowShadow.revalidateNow", new Object()); } else { // Graphics2D g2 = (Graphics2D)f.getGraphics(); // Composite oldComposite = g2.getComposite(); // g2.setComposite(AlphaComposite.Clear); // g2.fillRect(0,0,f.getWidth(),f.getHeight()); // g2.setComposite(oldComposite); // f.paint(g2); } } } }