javalook-and-feelnimbus

Set nimbus as the default look and feel for all java applications that run on your computer


I run this java code

import javax.swing.JOptionPane;

public class Dialog1{
        public static void main(String[] args){
                JOptionPane.showMessageDialog(null, "Welcome to Java");
        }
}

I get this

enter image description here

Then I say I want to set nimbus as the default look and feel for all java applications that run on my computer. So I write this code on a text editor and save the file as swing.properties

swing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel

I copy that file on C:\Program Files\Java\jdk-17\lib like this

enter image description here

When I run the code of class Dialog1 above I still get the same look and feel

enter image description here

I mean I thought I should get a nimbus look and feel, cause I did everything right or at least I think so. I wonder where I was wrong, someone please help. I use java version "17.0.10"


Solution

  • Some sites say lib or bin but it only worked for me with conf folder. Copy your new settings file to {jdk-17-home}\conf\swing.properties.