001/* 002 * $Id: WindowsLookAndFeelAddons.java 4092 2011-11-30 18:04:36Z kschaefe $ 003 * 004 * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle, 005 * Santa Clara, California 95054, U.S.A. All rights reserved. 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this library; if not, write to the Free Software 019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 020 */ 021package org.jdesktop.swingx.plaf.windows; 022 023import static javax.swing.UIManager.getLookAndFeel; 024import static javax.swing.UIManager.getSystemLookAndFeelClassName; 025 026import org.jdesktop.swingx.plaf.LookAndFeelAddons; 027import org.jdesktop.swingx.plaf.basic.BasicLookAndFeelAddons; 028import org.jdesktop.swingx.util.OS; 029import org.kohsuke.MetaInfServices; 030 031/** 032 * Adds new pluggable UI following the Windows XP look and feel. 033 */ 034@MetaInfServices(LookAndFeelAddons.class) 035public class WindowsLookAndFeelAddons extends BasicLookAndFeelAddons { 036 037 public static final String HOMESTEAD_VISUAL_STYLE = "HomeStead"; 038 039 public static final String SILVER_VISUAL_STYLE = "Metallic"; 040 041 public static final String VISTA_VISUAL_STYLE = "NormalColor"; 042 043 /** 044 * {@inheritDoc} 045 */ 046 @Override 047 protected boolean matches() { 048 if (isSystemAddon()) { 049 String laf = getLookAndFeel().getClass().getName(); 050 051 //special-case the jgoodies to ensure that we can match it 052 return getSystemLookAndFeelClassName().equals(laf) 053 || "com.jgoodies.looks.windows.WindowsLookAndFeel".equals(laf); 054 } 055 056 return false; 057 } 058 059 /** 060 * {@inheritDoc} 061 */ 062 @Override 063 protected boolean isSystemAddon() { 064 return OS.isWindows() && OS.isUsingWindowsVisualStyles(); 065 } 066 067// JW: reverting ... 068// /** 069// * {@inheritDoc} <p> 070// * 071// */ 072// @Override 073// public void initialize() { 074// super.initialize(); 075// // fix Issue #1305-swingx: wrapper for core issue #6753637 076// // set ui property to prevent eating mousePressed when closing popup 077// UIManager.put("PopupMenu.consumeEventOnClose", Boolean.FALSE); 078// } 079// 080// /** 081// * {@inheritDoc} <p> 082// */ 083// @Override 084// public void uninitialize() { 085// // fix Issue #1305-swingx: wrapper for core issue #6753637 086// // remove the ui property again 087// UIManager.put("PopupMenu.consumeEventOnClose", null); 088// super.uninitialize(); 089// } 090// 091 092 093}