JFrame 突然包含蓝色背景

JFrame suddenly contain blue background

我正在尝试在 Swing 上使用 JInternalFrame 创建一个简单的程序,当我 运行 我的代码时,它突然产生了蓝色背景。谁能告诉我如何删除它? 这是我试过的代码

import javax.swing.*;

public class Main extends JFrame {

    JDesktopPane dp = new JDesktopPane();
    JInternalFrame intf = new JInternalFrame("demo");

    public void initialize() {
        setTitle("Test Program");
        setSize(500, 500);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
    }

    public Main() {
        intf.setSize(150, 200);
        intf.setVisible(true);
        dp.add(intf);
        add(dp);
        initialize();
    }

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

}

它是 PL&F 的一部分。

要从字面上删除它,您可以使 JDesktopPane 不透明:

dp.setOpaque(false);

或者将背景设置为您喜欢的颜色:

dp.setBackground(new java.awt.Color(200,200,200));

但是浅色看起来怪怪的

可能有一些配置 macOS PL&F 的方法。一切都与 macOS 一起生活,看起来像 macOS 想要的样子。