2
我想使用JFrame从我的Java应用程序发送系统通知,并且我想在此通知中设置背景颜色。现在通知有效,但我无法更改背景颜色。 这是代码:如何更改JFrame的背景颜色
public class NotificationFrame extends JFrame{
/**
*
*/
private static final long serialVersionUID = -2902763674924791105L;
public NotificationFrame(){
super();
setUndecorated(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground(Color.red);
setMinimumSize(new Dimension(300, 100));
add(new LabelFormat("Notifiche"));
}
}
有了这个代码我的JFrame的背景颜色是everty时间灰色。