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

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

?? lookandfeeladdons.java

?? java swing控件
?? JAVA
字號:
/**
 * L2FProd.com Common Components 6.9.1 License.
 *
 * Copyright 2005-2006 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) {
      e.printStackTrace();
    }
    
    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一区二区三区免费野_久草精品视频
美女脱光内衣内裤视频久久影院| 国产精品伦一区二区三级视频| 一区二区三区高清| aaa欧美大片| 亚洲色图清纯唯美| 91久久精品网| 午夜精品久久久久久久99樱桃 | 国产一区二区三区av电影| 精品成人一区二区| 风流少妇一区二区| 一区二区三区精品| 欧美一卡二卡在线| 国产精品一卡二| 亚洲欧美国产77777| 欧美日韩精品三区| 九一九一国产精品| 国产精品国产三级国产aⅴ入口| 懂色一区二区三区免费观看| 亚洲精品日韩一| 欧美日韩第一区日日骚| 国产剧情一区在线| 亚洲色图19p| 在线综合亚洲欧美在线视频| 国产大陆精品国产| 亚洲第一在线综合网站| 精品成人一区二区三区四区| 色88888久久久久久影院野外| 日韩电影在线一区二区| 国产欧美视频一区二区| 欧美日韩一区二区三区高清| 国产精品综合一区二区三区| 中文字幕一区二区5566日韩| 欧美一区二区成人| 北条麻妃一区二区三区| 美女在线视频一区| 亚洲女女做受ⅹxx高潮| 久久色中文字幕| 欧美三级午夜理伦三级中视频| 国产精品亚洲人在线观看| 亚洲一区在线观看网站| 中文字幕免费一区| 日韩一区二区三区免费看| 99精品久久免费看蜜臀剧情介绍| 蜜桃视频一区二区三区| 亚洲精品成人精品456| 中文字幕欧美激情| 欧美成va人片在线观看| 欧美在线观看视频一区二区三区| 国产一区二区三区精品欧美日韩一区二区三区 | 精品国产凹凸成av人网站| 一本在线高清不卡dvd| 国产精品一区二区果冻传媒| 性感美女久久精品| 亚洲精品你懂的| 国产精品美女久久久久av爽李琼 | 在线一区二区三区做爰视频网站| 国产毛片一区二区| 日韩成人dvd| 亚洲一二三专区| 伊人色综合久久天天人手人婷| 亚洲国产精品99久久久久久久久| 精品国产免费久久| 91精品国产91久久综合桃花| 欧美色视频一区| 色婷婷综合久久久中文一区二区| 成+人+亚洲+综合天堂| 国产高清不卡一区二区| 精品无人码麻豆乱码1区2区 | 一片黄亚洲嫩模| 国产精品久久久久四虎| 国产精品伦一区| 欧美国产日韩亚洲一区| 国产欧美一区二区三区在线看蜜臀| 精品精品国产高清a毛片牛牛| 欧美日韩国产a| 欧美二区三区91| 69久久夜色精品国产69蝌蚪网| 欧美老肥妇做.爰bbww视频| 欧美午夜一区二区三区免费大片| 欧美色窝79yyyycom| 色成年激情久久综合| 欧美最猛性xxxxx直播| 欧美日韩一区二区在线视频| 欧美精品日韩一本| 日韩三级视频在线观看| 精品国产免费人成电影在线观看四季| 日韩精品一区二区三区swag| 久久综合狠狠综合久久综合88| 精品少妇一区二区三区 | 激情都市一区二区| 狠狠色丁香婷婷综合久久片| 国产乱码精品一区二区三区av| 国产福利一区二区三区| aaa欧美日韩| 欧美色精品在线视频| 91精品国产麻豆| 久久久久久亚洲综合影院红桃| 国产精品系列在线| 亚洲综合小说图片| 午夜婷婷国产麻豆精品| 久久99精品视频| www.日韩av| 欧美日韩mp4| 欧美—级在线免费片| 亚洲精品成人少妇| 蜜桃视频一区二区| 粗大黑人巨茎大战欧美成人| 欧美性猛交一区二区三区精品| 91精品国产色综合久久不卡蜜臀| 久久久久久久综合色一本| 中文无字幕一区二区三区| 亚洲免费观看高清完整版在线| 男男gaygay亚洲| www.性欧美| 日韩三级在线观看| 亚洲色大成网站www久久九九| 午夜一区二区三区在线观看| 国产精品亚洲а∨天堂免在线| 在线观看www91| 日韩欧美一区在线| 国产精品对白交换视频| 免费观看在线色综合| 99视频超级精品| 91精品国产色综合久久不卡蜜臀| 国产精品美女久久福利网站| 五月婷婷综合网| 成人av网址在线观看| 日韩视频在线永久播放| 亚洲精品久久7777| 国产精品99久久久| 欧美日韩国产一区| 中文字幕一区二区三区在线不卡 | 亚洲国产视频一区| 国产麻豆一精品一av一免费| 欧美日韩国产一区二区三区地区| 国产日韩高清在线| 日韩av一区二区三区四区| 成人网男人的天堂| 精品久久国产老人久久综合| 一区二区三区四区av| 成人一级视频在线观看| 91精品国产综合久久福利软件| 亚洲欧美国产三级| 成人av在线一区二区| 久久免费看少妇高潮| 久久精品国产一区二区三区免费看| 色悠悠久久综合| 一区在线观看免费| 国产黄色精品网站| 精品电影一区二区| 美女免费视频一区二区| 欧美日韩免费一区二区三区 | 中文一区在线播放| 国产一区二区三区高清播放| 欧美sm美女调教| 美日韩黄色大片| 日韩一区二区三区电影| 日韩精品一二三区| 欧美性三三影院| 亚洲国产精品久久久久婷婷884| 91啪在线观看| 亚洲欧美韩国综合色| 一本大道久久a久久精品综合| 亚洲欧洲日韩女同| av在线播放一区二区三区| 国产女人18水真多18精品一级做| 国产精品中文字幕一区二区三区| 精品三级在线看| 国产精品一区一区三区| 久久先锋资源网| 国产精华液一区二区三区| 久久久美女艺术照精彩视频福利播放| 国产精品自拍在线| 国产欧美日本一区视频| 成人精品免费看| 亚洲色图在线视频| 欧美色图第一页| 日本成人在线不卡视频| 欧美成人猛片aaaaaaa| 狠狠色狠狠色综合日日91app| 久久久亚洲高清| 99这里都是精品| 亚洲欧美二区三区| 欧美精品乱码久久久久久按摩| 美女久久久精品| 欧美经典一区二区| 一本色道久久综合亚洲91| 亚洲亚洲精品在线观看| 在线不卡a资源高清| 国内精品免费**视频| 欧美国产日韩一二三区| 欧美伊人久久久久久久久影院| 亚洲h在线观看| 欧美精品一区二区不卡| caoporen国产精品视频| 亚洲h在线观看| 久久久久99精品一区| 在线观看www91| 激情久久五月天| 一区二区久久久|