Getting OS animation preferences in Java

I have a Java application whose windows and internal components have animations that can slow down a less powerful computer. I know that all OSs have some form of animation preference (on Windows there are checkboxes for "Animating controls and elements inside windows", on Linux there is a choice for Full, Basic, or No animations, and on OSX you can do, for example, type " defaults write com.apple.dock workspaces-edge-delay -float 0.0; killall Dock "or" defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO "to the terminal). Is there a way to find out if the user has animations on or off so that I can match my preferences?

+4
source share
1 answer

I would think that since Java is an agnostic of the operating system, there is no specific API for this, native or third-party, (although this may be). You can use a combination of JNI and / or execute external commands and then interpret their outputs to determine if animations are enabled. To do this, you will have to request the os.name system property and run certain commands for this OS. I think it will be a little painful, and you may just want to give users the option to turn off the animation.

Personally, I would prefer the option, because I can turn on the animation of the OS, because they are annoying, but they can enjoy the animation in your application.

+4
source

All Articles