Is a certain Look and Feel guaranteed to be available?
Asked Answered
C

2

9

From what I've found out, the Nimbus Look and Feel was introduced in Java 6 Update 10.

I have project where I use that Look and Feel.

Is there any situation where, the user has a Java VM newer than 6 update 10 (for example 6 update 26) and the Nimbus Look and Feel is not available ? This situation might occur if for example, Look and Feels can be manually/explicitly removed, but I've not been able to find out if this can be done.

So basically, is there a 100 % guarantee that, if the user has the proper Java VM version, the Nimbus Look and Feel will be available 100 % of the time ?

Thank you in advance.

Contortionist answered 9/1, 2012 at 18:39 Comment(0)
A
4

There's no clear way for a user to remove a particular Look & Feel from their JVM. Anything is possible, though.

What's wrong with just checking for it in the code?

Ankerite answered 9/1, 2012 at 18:42 Comment(3)
Well, a particular problem is with JTextFields. In Nimbus their height is a lot smaller and, if Nimbus is applied, I must make them bigger.Contortionist
Are you asking how to detect and react to Nimbus being installed?Ankerite
No, I know how to do that. I'm asking if I need to. If there is no way a user can remove Look and Feel's from the JVM, then I don't need to. But if he can...Contortionist
L
4

In Java 7 the package path is changed ("sun" removed: com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel): javax.swing.plaf.nimbus.NimbusLookAndFeel, so it depends how you invoke the look and feel. In general this action of oracle might be seen as a positive endorsement of the nimbus look and feel.

Leptorrhine answered 9/1, 2012 at 18:52 Comment(1)
Note that they didn't remove the old name. They retained the class com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel as an empty extension of javax.swing.plaf.nimbus.NimbusLookAndFeel, so code which uses the Java 6 class name still works fine.Ebert

© 2022 - 2024 — McMap. All rights reserved.