Java: Determine whether the current operating system interface is themed with Windows Classic or XP style

Source: Internet
Author: User

Remember two or three years ago, when the Java interface was found, if the current interface layout is set to NULL, due to the different themes of Windows, the title bar height inconsistency, resulting in inconsistent performance of the current interface.

At that time, I wanted to find a way to determine whether the current user's theme is classic style or XP style, but has not been found.

There is no intention of discovering a piece of code in the Com.sun.java.swing.plaf.windows.StyleXP class today:

/**Get The Singleton instance of this class * *@returnThe singleton instance of this class or null if XP styles * was not active or if this is not Windows XP */     Static synchronizedXpstyle Getxp () {if(Themeactive = =NULL) {Toolkit Toolkit=Toolkit.getdefaulttoolkit (); Themeactive=(Boolean) Toolkit.getdesktopproperty ("Win.xpstyle.themeActive"); if(Themeactive = =NULL) {themeactive=Boolean.false; }             if(Themeactive.booleanvalue ()) {getpropertyaction propertyaction=NewGetpropertyaction ("Swing.noxp"); if(accesscontroller.doprivileged (propertyaction) = =NULL&&themereader.isthemed ()&&!(Uimanager.getlookandfeel ()instanceofWindowsclassiclookandfeel)) {XP=NewXpstyle (); }             }         }         returnXP; }

The original Toolkit.getdefaulttoolkit (). Getdesktopproperty ("Win.xpstyle.themeActive") method is used to return the current theme style.

2007-07-04

Java: Determine whether the current operating system interface is themed with Windows Classic or XP style

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.