0

我无法更改 JApplet 的背景颜色。它总是灰色的。我在 NetBeans 工作。有人有什么建议吗?谢谢你。

解决方案感谢Крысa的回答,以下是问题的解决方案:必须使用getContentPane().setBackground(Color.WHITE);

@Override
public void init() {

    /* Set the Nimbus look and feel */
    //Look and feel setting code (optional)

    /* Create and display the applet */
    try {
        java.awt.EventQueue.invokeAndWait(new Runnable() {

            public void run() {
                getContentPane().setBackground(Color.WHITE);
                initComponents();
            }
        });
    } catch (Exception ex) {}

}

4

1 回答 1

1

您需要设置内容窗格JApplet的背景。

于 2011-12-02T14:13:13.290 回答