0
我无法更改JApplet的背景颜色。它始终是灰色的。我在NetBeans中工作。任何人有任何建议?谢谢。Java - Japplet无法更改背景颜色
解决方案感谢Крыс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) {}
}
我们可以看到代码吗? – SJuan76