亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lookandfeeladdons.java

?? 精美開源Swing組件
?? JAVA
字號:
/**
 * L2FProd.com Common Components 7.3 License.
 *
 * Copyright 2005-2007 L2FProd.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.l2fprod.common.swing.plaf;

import com.l2fprod.common.swing.plaf.aqua.AquaLookAndFeelAddons;
import com.l2fprod.common.swing.plaf.metal.MetalLookAndFeelAddons;
import com.l2fprod.common.swing.plaf.windows.WindowsClassicLookAndFeelAddons;
import com.l2fprod.common.swing.plaf.windows.WindowsLookAndFeelAddons;
import com.l2fprod.common.util.OS;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLookAndFeel;

/**
 * Provides additional pluggable UI for new components added by the
 * library. By default, the library uses the pluggable UI returned by
 * {@link #getBestMatchAddonClassName()}.
 * <p>
 * The default addon can be configured using the
 * <code>swing.addon</code> system property as follow:
 * <ul>
 * <li>on the command line,
 * <code>java -Dswing.addon=ADDONCLASSNAME ...</code></li>
 * <li>at runtime and before using the library components
 * <code>System.getProperties().put("swing.addon", ADDONCLASSNAME);</code>
 * </li>
 * </ul>
 * <p>
 * The addon can also be installed directly by calling the
 * {@link #setAddon(String)}method. For example, to install the
 * Windows addons, add the following statement
 * <code>LookAndFeelAddons.setAddon("com.l2fprod.common.swing.plaf.windows.WindowsLookAndFeelAddons");</code>.
 * 
 * @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a> 
 */
public class LookAndFeelAddons {

  private static List contributedComponents = new ArrayList();

  /**
   * Key used to ensure the current UIManager has been populated by the
   * LookAndFeelAddons.
   */
  private static final Object APPCONTEXT_INITIALIZED = new Object();

  private static boolean trackingChanges = false;
  private static PropertyChangeListener changeListener;    

  static {
    // load the default addon
    String addonClassname = getBestMatchAddonClassName();
    try {
      addonClassname = System.getProperty("swing.addon", addonClassname);
    } catch (SecurityException e) {
      // security exception may arise in Java Web Start
    }

    try {
      setAddon(addonClassname);
      setTrackingLookAndFeelChanges(true);      
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }

  private static LookAndFeelAddons currentAddon;

  public void initialize() {
    for (Iterator iter = contributedComponents.iterator(); iter.hasNext();) {
      ComponentAddon addon = (ComponentAddon)iter.next();
      addon.initialize(this);
    }
  }

  public void uninitialize() {
    for (Iterator iter = contributedComponents.iterator(); iter.hasNext();) {
      ComponentAddon addon = (ComponentAddon)iter.next();
      addon.uninitialize(this);
    }
  }

  /**
   * Adds the given defaults in UIManager.
   * 
   * Note: the values are added only if they do not exist in the existing look
   * and feel defaults. This makes it possible for look and feel implementors to
   * override library defaults.
   * 
   * Note: the array is traversed in reverse order. If a key is found twice in
   * the array, the key/value with the highest position in the array gets
   * precedence over the other key in the array
   * 
   * @param keysAndValues
   */
  public void loadDefaults(Object[] keysAndValues) {    
    // Go in reverse order so the most recent keys get added first...
    for (int i = keysAndValues.length - 2; i >= 0; i = i - 2) {
      if (UIManager.getLookAndFeelDefaults().get(keysAndValues[i]) == null) {
        UIManager.getLookAndFeelDefaults().put(keysAndValues[i], keysAndValues[i + 1]);
      }
    }
  }

  public void unloadDefaults(Object[] keysAndValues) {
    for (int i = 0, c = keysAndValues.length; i < c; i = i + 2) {
      UIManager.getLookAndFeelDefaults().put(keysAndValues[i], null);
    }
  }

  public static void setAddon(String addonClassName)
    throws InstantiationException, IllegalAccessException,
    ClassNotFoundException {
    setAddon(Class.forName(addonClassName));
  }

  public static void setAddon(Class addonClass) throws InstantiationException,
    IllegalAccessException {
    LookAndFeelAddons addon = (LookAndFeelAddons)addonClass.newInstance();
    setAddon(addon);
  }
   
  public static void setAddon(LookAndFeelAddons addon) {
    if (currentAddon != null) {
      currentAddon.uninitialize();
    }

    addon.initialize();
    currentAddon = addon;    
    UIManager.put(APPCONTEXT_INITIALIZED, Boolean.TRUE);
  }

  public static LookAndFeelAddons getAddon() {
    return currentAddon;
  }

  /**
   * Based on the current look and feel (as returned by
   * <code>UIManager.getLookAndFeel()</code>), this method returns
   * the name of the closest <code>LookAndFeelAddons</code> to use.
   * 
   * @return the addon matching the currently installed look and feel
   */
  public static String getBestMatchAddonClassName() {
    String lnf = UIManager.getLookAndFeel().getClass().getName();
    String addon;
    if (UIManager.getCrossPlatformLookAndFeelClassName().equals(lnf)) {
      addon = MetalLookAndFeelAddons.class.getName();
    } else if (UIManager.getSystemLookAndFeelClassName().equals(lnf)) {
      addon = getSystemAddonClassName();
    } else if ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel".equals(lnf) ||
      "com.jgoodies.looks.windows.WindowsLookAndFeel".equals(lnf)) {
      if (OS.isUsingWindowsVisualStyles()) {
        addon = WindowsLookAndFeelAddons.class.getName();
      } else {
        addon = WindowsClassicLookAndFeelAddons.class.getName();
      }
    } else if ("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"
      .equals(lnf)) {
      addon = WindowsClassicLookAndFeelAddons.class.getName();
    } else if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) {
      // for JGoodies and other sub-l&fs of Metal
      addon = MetalLookAndFeelAddons.class.getName();
    } else {
      addon = getSystemAddonClassName();
    }
    return addon;
  }

  /**
   * Gets the addon best suited for the operating system where the
   * virtual machine is running.
   * 
   * @return the addon matching the native operating system platform.
   */
  public static String getSystemAddonClassName() {
    String addon = WindowsClassicLookAndFeelAddons.class.getName();

    if (OS.isMacOSX()) {
      addon = AquaLookAndFeelAddons.class.getName();
    } else if (OS.isWindows()) {
      // see whether of not visual styles are used
      if (OS.isUsingWindowsVisualStyles()) {
        addon = WindowsLookAndFeelAddons.class.getName();
      } else {
        addon = WindowsClassicLookAndFeelAddons.class.getName();
      }
    }

    return addon;
  }

  /**
   * Each new component added by the library will contribute its
   * default UI classes, colors and fonts to the LookAndFeelAddons.
   * See {@link ComponentAddon}.
   * 
   * @param component
   */
  public static void contribute(ComponentAddon component) {
    contributedComponents.add(component);

    if (currentAddon != null) {
      // make sure to initialize any addons added after the
      // LookAndFeelAddons has been installed
      component.initialize(currentAddon);
    }
  }

  /**
   * Removes the contribution of the given addon
   * 
   * @param component
   */
  public static void uncontribute(ComponentAddon component) {
    contributedComponents.remove(component);
    
    if (currentAddon != null) {
      component.uninitialize(currentAddon);
    }
  }

  /**
   * Workaround for IDE mixing up with classloaders and Applets environments.
   * Consider this method as API private. It must not be called directly.
   * 
   * @param component
   * @param expectedUIClass
   * @return an instance of expectedUIClass 
   */
  public static ComponentUI getUI(JComponent component, Class expectedUIClass) {
    maybeInitialize();

    // solve issue with ClassLoader not able to find classes
    String uiClassname = (String)UIManager.get(component.getUIClassID());
    try {
      Class uiClass = Class.forName(uiClassname);
      UIManager.put(uiClassname, uiClass);
    } catch (Exception e) {
      // we ignore the ClassNotFoundException
    }
    
    ComponentUI ui = UIManager.getUI(component);
    
    if (expectedUIClass.isInstance(ui)) {
      return ui;
    } else {
      String realUI = ui.getClass().getName();
      Class realUIClass;
      try {
        realUIClass = expectedUIClass.getClassLoader()
        .loadClass(realUI);
      } catch (ClassNotFoundException e) {
        throw new RuntimeException("Failed to load class " + realUI, e);
      }
      Method createUIMethod = null;
      try {
        createUIMethod = realUIClass.getMethod("createUI", new Class[]{JComponent.class});
      } catch (NoSuchMethodException e1) {
        throw new RuntimeException("Class " + realUI + " has no method createUI(JComponent)");
      }
      try {
        return (ComponentUI)createUIMethod.invoke(null, new Object[]{component});
      } catch (Exception e2) {
        throw new RuntimeException("Failed to invoke " + realUI + "#createUI(JComponent)");
      }
    }
  }
  
  /**
   * With applets, if you reload the current applet, the UIManager will be
   * reinitialized (entries previously added by LookAndFeelAddons will be
   * removed) but the addon will not reinitialize because addon initialize
   * itself through the static block in components and the classes do not get
   * reloaded. This means component.updateUI will fail because it will not find
   * its UI.
   * 
   * This method ensures LookAndFeelAddons get re-initialized if needed. It must
   * be called in every component updateUI methods.
   */
  private static synchronized void maybeInitialize() {
    if (currentAddon != null) {
      // this is to ensure "UIManager#maybeInitialize" gets called and the
      // LAFState initialized
      UIManager.getLookAndFeelDefaults();
      
      if (!UIManager.getBoolean(APPCONTEXT_INITIALIZED)) {
        setAddon(currentAddon);
      }
    }
  }
  
  //
  // TRACKING OF THE CURRENT LOOK AND FEEL
  //  
  private static class UpdateAddon implements PropertyChangeListener {
    public void propertyChange(PropertyChangeEvent evt) {
      try {
        setAddon(getBestMatchAddonClassName());
      } catch (Exception e) {
        // should not happen
        throw new RuntimeException(e);
      }
    }
  }
  
  /**
   * If true, everytime the Swing look and feel is changed, the addon which
   * best matches the current look and feel will be automatically selected.
   * 
   * @param tracking
   *          true to automatically update the addon, false to not automatically
   *          track the addon. Defaults to false.
   * @see #getBestMatchAddonClassName()
   */
  public static synchronized void setTrackingLookAndFeelChanges(boolean tracking) {
    if (trackingChanges != tracking) {
      if (tracking) {
        if (changeListener == null) {
          changeListener = new UpdateAddon();
        }
        UIManager.addPropertyChangeListener(changeListener);
      } else {
        if (changeListener != null) {
          UIManager.removePropertyChangeListener(changeListener);
        }
        changeListener = null;
      }
      trackingChanges = tracking;
    }
  }
  
  /**
   * @return true if the addon will be automatically change to match the current
   *         look and feel
   * @see #setTrackingLookAndFeelChanges(boolean)
   */
  public static synchronized boolean isTrackingLookAndFeelChanges() {
    return trackingChanges;
  }
  
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品免费一区二区三区| 91久久精品午夜一区二区| 日韩色视频在线观看| 肉丝袜脚交视频一区二区| 在线观看一区二区精品视频| 一区二区三区蜜桃网| 欧美三片在线视频观看| 欧美aⅴ一区二区三区视频| 日韩免费高清av| 国产乱子伦一区二区三区国色天香| 亚洲精品一区二区三区蜜桃下载| 国产一区二区在线视频| 国产精品电影一区二区| 欧美日韩中文另类| 久久99精品久久久久久国产越南| 欧美高清在线一区| 欧美无乱码久久久免费午夜一区| 日本人妖一区二区| 国产精品久久一卡二卡| 欧美午夜免费电影| 韩国精品主播一区二区在线观看 | 99re热这里只有精品视频| 亚洲毛片av在线| 日韩三级电影网址| 99精品视频免费在线观看| 视频一区二区三区入口| 国产精品沙发午睡系列990531| 欧美伊人久久久久久久久影院| 蜜桃视频第一区免费观看| 国产精品久久久久aaaa| 欧美一区午夜精品| 99久久精品国产导航| 日韩精品久久久久久| 亚洲国产成人午夜在线一区| 51午夜精品国产| gogo大胆日本视频一区| 秋霞午夜鲁丝一区二区老狼| 亚洲摸摸操操av| 久久精品夜色噜噜亚洲aⅴ| 欧美日韩一区在线| 99久久久国产精品| 国产精品一二二区| 日韩av电影免费观看高清完整版 | 色偷偷久久人人79超碰人人澡| 日韩高清欧美激情| 一区二区三区精品久久久| 亚洲精品一线二线三线无人区| 欧洲国产伦久久久久久久| 国产传媒欧美日韩成人| 免费精品99久久国产综合精品| 曰韩精品一区二区| 国产精品欧美精品| 久久久久国产精品免费免费搜索| 欧美久久一二三四区| 97超碰欧美中文字幕| 国产自产2019最新不卡| 秋霞午夜鲁丝一区二区老狼| 亚洲一区二区三区四区在线免费观看 | 麻豆国产精品777777在线| 亚洲精品伦理在线| 一区精品在线播放| 国产精品高潮呻吟| 国产精品污www在线观看| 久久免费的精品国产v∧| 日韩欧美国产wwwww| 欧美日韩国产系列| 欧美性色aⅴ视频一区日韩精品| 不卡的看片网站| av电影天堂一区二区在线| 成人综合在线视频| 成人免费av网站| 菠萝蜜视频在线观看一区| 丁香六月综合激情| 国产a久久麻豆| 成人午夜又粗又硬又大| 92国产精品观看| www.欧美色图| 91网上在线视频| 欧洲精品在线观看| 欧美妇女性影城| 欧美一区二区视频在线观看| 制服.丝袜.亚洲.中文.综合| 欧美精品亚洲一区二区在线播放| 在线不卡一区二区| 日韩欧美一区二区不卡| 久久综合999| 国产精品女主播av| 亚洲精品免费一二三区| 亚洲成a天堂v人片| 日韩激情在线观看| 国产一区二区三区av电影| 粉嫩av亚洲一区二区图片| 91亚洲大成网污www| 欧美午夜精品理论片a级按摩| 欧美日韩精品欧美日韩精品一| 91精选在线观看| 久久久久88色偷偷免费| 亚洲男人的天堂一区二区 | 日韩va亚洲va欧美va久久| 美女精品一区二区| 国产寡妇亲子伦一区二区| aaa欧美日韩| 51久久夜色精品国产麻豆| 久久中文字幕电影| 亚洲视频免费在线| 全部av―极品视觉盛宴亚洲| 国产乱子伦一区二区三区国色天香| 成人蜜臀av电影| 欧美日韩精品三区| 国产亚洲人成网站| 玉足女爽爽91| 国产麻豆午夜三级精品| 日本高清不卡在线观看| 日韩一级欧美一级| 中文一区二区在线观看| 日韩精品91亚洲二区在线观看| 国产寡妇亲子伦一区二区| 欧日韩精品视频| 久久久久久久久久久黄色| 亚洲精品菠萝久久久久久久| 男人的j进女人的j一区| 97久久精品人人做人人爽| 日韩一区二区三区在线观看| 国产精品久久一级| 久久精品国产第一区二区三区| 91麻豆高清视频| 久久综合九色欧美综合狠狠| 亚洲国产精品人人做人人爽| 国产麻豆视频精品| 欧美一三区三区四区免费在线看| 国产精品视频一区二区三区不卡| 天天操天天色综合| 91色乱码一区二区三区| 欧美精品一区二区三区蜜桃视频| 亚洲伊人色欲综合网| 成人av动漫网站| 精品日韩一区二区三区免费视频| 亚洲午夜精品久久久久久久久| 粉嫩13p一区二区三区| 精品毛片乱码1区2区3区| 亚洲丰满少妇videoshd| 91网站在线播放| 欧美国产精品一区二区| 国产在线不卡一卡二卡三卡四卡| 欧美日韩视频第一区| 亚洲精品国产品国语在线app| 国产成人综合亚洲91猫咪| 91精品国产欧美一区二区18| 亚洲一区在线观看免费| 99re热这里只有精品免费视频| 国产女人18毛片水真多成人如厕 | 国产福利不卡视频| 欧美成人国产一区二区| 天堂影院一区二区| 欧美亚洲另类激情小说| 亚洲精品v日韩精品| 99久久国产免费看| 亚洲欧洲韩国日本视频| 成人深夜福利app| 国产精品嫩草久久久久| 国产精品1024| 国产精品欧美一区喷水| 国产suv精品一区二区883| 国产欧美中文在线| 国产一区二区在线看| 久久久国际精品| 国产a视频精品免费观看| 中文字幕不卡一区| 成人丝袜18视频在线观看| 国产精品久久久久影院老司| 成人精品免费看| 国产精品福利一区二区三区| www.色综合.com| 亚洲蜜臀av乱码久久精品蜜桃| 在线观看视频一区二区欧美日韩| 亚洲激情自拍偷拍| 欧美亚男人的天堂| 免费欧美日韩国产三级电影| 精品国产乱码久久久久久图片| 国产乱国产乱300精品| 日本一区二区三区在线不卡| 成人h版在线观看| 成人免费在线视频| 欧美午夜精品一区二区蜜桃| 午夜精品久久久久久久蜜桃app| 4438x亚洲最大成人网| 精品一区二区三区免费观看| 久久精品人人做| 99久久国产综合精品色伊 | 亚洲人吸女人奶水| 欧美三级电影精品| 免费成人在线视频观看| 国产午夜精品一区二区三区嫩草 | 国产精品久久久久7777按摩| 色婷婷亚洲婷婷| 麻豆精品一二三| 国产欧美日本一区视频| 欧美视频自拍偷拍| 韩国精品一区二区| 亚洲一区在线视频|