Detecting the users operating system in Java code?

K.I.L.E.R

Retarded moron
Veteran
How would I be able to get the persons OS?

Reason I aks is that I want to write programs that will use the XP layout if it detects an XP OS and a system default layout for every other OS.

I know how to do that, what I can't find out is the syntax to detect an OS.
 
It should work as described, but shouldn't it work automatically?
From the 1.4.2 release notes:

"[Swing Enhancements:]The Microsoft Windows XP look and feel. If you are using the system look and feel on the Windows XP platform, Swing components now match the platform."
 
Yes it does. I found that out.

Code:
try
		{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch(Exception lf){}

This works fine. :D
 
Back
Top