Search code examples
javamacosswinglook-and-feeljinternalframe

Disabling the shadow around JInternalFrames with the Aqua Look and Feel


On Mac OS X with the native Aqua Look and Feel, JInternalFrames have a shadow that is part of the frame border. When the internal frame is maximized, the shadow is still visible and takes a lot of space.

Is there a way to remove this shadow without switching to another look and feel?


Solution

  • After digging into the Aqua L&F code in OpenJDK I found an undocumented property that let you change the style of an internal frame. Shadows can be removed with this:

    internalFrame.putClientProperty("JInternalFrame.frameType", "normal");
    

    http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/087d8f180711/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java