That's not how UI defaults work: "text"
is not a valid name, and no component can see your defaults
instance. Instead, try
jLabel1.setForeground(Color.red);
Also, don't use setBounds()
; use a suitable layout manager.
Addendum: As shown here, "text"
is a valid primary color key, not a component key.
I…want to…override the nimbus default.
On most L&F's you can specify the "Label.foreground"
key:
UIManager.put("Label.foreground", Color.red);
On Nimbus you have to do this:
UIManager.put("text", Color.red);
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");