on base of thread How to change the background color for JPanels with Nimbus Look and Feel? is possible to change and assign one value for something from Nimbus Defaults
,
but are you sure that you needed this output to the GUI, nothing nice
v.s. basic JButton with Nimbus L&F
from code
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.InsetsUIResource;
public class NimbusJPanelBackGround {
public NimbusJPanelBackGround() {
JButton btn = new JButton(" Whatever ");
JButton btn1 = new JButton(" Whatever ");
JPanel p = new JPanel();
p.add(btn);
p.add(btn1);
JFrame f = new JFrame();
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.add(p, BorderLayout.CENTER);
f.setSize(200, 100);
f.setLocation(150, 150);
f.setVisible(true);
}
public static void main(String[] args) {
try {
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(laf.getName())) {
UIManager.setLookAndFeel(laf.getClassName());
UIManager.getLookAndFeelDefaults().put("Panel.background", Color.white);
UIManager.getLookAndFeelDefaults().put("Button.contentMargins", new InsetsUIResource(0,0,0,0));
}
}
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
NimbusJPanelBackGround nimbusJPanelBackGround = new NimbusJPanelBackGround();
}
});
}
}
previously +1 for interesting question