0

I'm using a 10.7.4 Retina. My JFrame doesn't look as expected when I'm using getRootPane().putClientProperty("apple.awt.brushMetalLook", true);
I tried running it on the JVM 1.6.0_51. It will look like this:
enter image description here

Even tried it with -d32 and -d64.

And when I'm running it on the latest JVM 1.7.0_25 it will look like this:
enter image description here

Both doesn't look like as they should when I'm running it on JVM 1.6.0_15 on a 10.6 mac:
enter image description here

Is there a way to solve this problem? Might the retina resolution be the cause? This post is kinda related to this one in asked before: JFrame is lagging on resize

Community
  • 1
  • 1
domizai
  • 343
  • 1
  • 5
  • 13

1 Answers1

2

Yes, you can solve this problem by putting the client property as early as possible.

The Documentation says:

WARNING: This property must be set before the heavyweight peer for the Window is created. Once addNotify() has been called on the component, causing creation of the heavyweight peer, changing this property has no effect.

Here is a MWE:

import javax.swing.JFrame;

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Hello World");
        frame.getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
        frame.setSize(400, 300);
        frame.setVisible(true);
    }
}

Screenshot of MWE

If you swap frame.setVisible(true); and the part where we put the client property, you get a black frame (Mac OS 10.9.4, Java 1.8.0_05):

Bad example

Hope, that helped you.