简体   繁体   中英

Need rounded bottom corners on JFrame for Mac OS X El Capitan

I notice that nearly every application but mine has a window border with 4 rounded corners. Mine has rounded corners only on the top. Below is my SSCCE and it does not produce what I want even when I vary the jdk version (7 and 8) and vary the laf (Metal, Nimbus, CDE/Motif, Mac OS X). In my early tests, I tried undecorating the frame but that causes more problems than it solves.

import javax.swing.JFrame;

public class TestMacFrame extends JFrame {

    public TestMacFrame() {
        super();
        setSize(200, 200);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
    }

    public static void main(String[] args) {
        new TestMacFrame();
    }
}

在此处输入图片说明

Here is what it looks like on Yosemite with Java 8 and the default laf. The corners are rounded but it's difficult to tell unless you zoom in on the image. It seems as though the window manager is doing something different but I have no idea how to get a handle on it.

在此处输入图片说明

在优胜美地上安装Java 8之后,我可以运行代码并查看4个圆角。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM