문제

So i used the following code to set the look and feel of my program to windows since i don't really like any of the themes like nimbus or the default swing theme but some component are still appearing with the old look and feel and not my windows LaF.

Code used:

try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Windows".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }
} catch (Exception e) {
}

However, some stuff like scroll bars and combo boxes still look like this:

1

Same with scroll bars, they are not like my windows's scroll bars.

도움이 되었습니까?

해결책

I added the look and feel change before anything was initialized and that seems to have done the trick, ..

No worries, but see also getSystemLookAndFeelClassName() which is better than hard-coding Windows in that:

  • It will be reliable over time.
  • It will also work for OS X & *nix.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top