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

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

?? userpreferences.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;

import com.l2fprod.common.util.converter.ConverterRegistry;

import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.prefs.Preferences;

import javax.swing.JFileChooser;
import javax.swing.JSplitPane;
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;

/**
 * UserPreferences. <BR>
 *  
 */
public class UserPreferences {

  /**
   * Gets the default file chooser. Its current directory will be tracked and
   * restored on subsequent calls.
   * 
   * @return the default file chooser
   */
  public static JFileChooser getDefaultFileChooser() {
    return getFileChooser("default");
  }

  /**
   * Gets the default directory chooser. Its current directory will be tracked
   * and restored on subsequent calls.
   * 
   * @return the default directory chooser
   */
  public static JFileChooser getDefaultDirectoryChooser() {
    return getDirectoryChooser("default");
  }

  /**
   * Gets the file chooser with the given id. Its current directory will be
   * tracked and restored on subsequent calls.
   * 
   * @param id
   * @return the file chooser with the given id
   */
  public static JFileChooser getFileChooser(final String id) {
    JFileChooser chooser = new JFileChooser();
    track(chooser, "FileChooser." + id + ".path");
    return chooser;
  }

  /**
   * Gets the directory chooser with the given id. Its current directory will
   * be tracked and restored on subsequent calls.
   * 
   * @param id
   * @return the directory chooser with the given id
   */
  public static JFileChooser getDirectoryChooser(String id) {
    JFileChooser chooser;
    try {
      Class directoryChooserClass =
        Class.forName("com.l2fprod.common.swing.JDirectoryChooser");
      chooser = (JFileChooser)directoryChooserClass.newInstance();
    } catch (Exception e) {
      chooser = new JFileChooser();
      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
    track(chooser, "DirectoryChooser." + id + ".path");
    return chooser;
  }

  private static void track(JFileChooser chooser, final String key) {
    // get the path for the given filechooser
    String path = node().get(key, null);
    if (path != null) {
      File file = new File(path);
      if (file.exists()) {
        chooser.setCurrentDirectory(file);
      }
    }

    PropertyChangeListener trackPath = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
        /* everytime the path change, update the preferences */
        if (evt.getNewValue() instanceof File) {
          node().put(key, ((File)evt.getNewValue()).getAbsolutePath());
        }
      }
    };

    chooser.addPropertyChangeListener(
      JFileChooser.DIRECTORY_CHANGED_PROPERTY,
      trackPath);
  }

  /**
   * Restores the window size, position and state if possible. Tracks the
   * window size, position and state.
   * 
   * @param window
   */
  public static void track(Window window) {
    Preferences prefs = node().node("Windows");

    String bounds = prefs.get(window.getName() + ".bounds", null);
    if (bounds != null) {
      Rectangle rect =
        (Rectangle)ConverterRegistry.instance().convert(
          Rectangle.class,
          bounds);
      window.setBounds(rect);
    }

    window.addComponentListener(windowDimension);
  }

  private static ComponentListener windowDimension = new ComponentAdapter() {
    public void componentMoved(ComponentEvent e) {
      store((Window)e.getComponent());
    }
    public void componentResized(ComponentEvent e) {
      store((Window)e.getComponent());
    }
    private void store(Window w) {
      String bounds =
        (String)ConverterRegistry.instance().convert(
          String.class,
          w.getBounds());
      node().node("Windows").put(w.getName() + ".bounds", bounds);
    }
  };

  /**
   * Restores the text. Stores the text.
   * 
   * @param text
   */
  public static void track(JTextComponent text) {
    new TextListener(text);
  }
  
  private static class TextListener implements DocumentListener {
    private JTextComponent text;
    public TextListener(JTextComponent text) {
      this.text = text;
      restore();
      text.getDocument().addDocumentListener(this);
    }
    public void changedUpdate(javax.swing.event.DocumentEvent e) { store(); }
    public void insertUpdate(javax.swing.event.DocumentEvent e) { store(); }
    public void removeUpdate(javax.swing.event.DocumentEvent e) { store(); }
    void restore() {      
      Preferences prefs = node().node("JTextComponent");
      text.setText(prefs.get(text.getName(), ""));      
    }
    void store() {
      Preferences prefs = node().node("JTextComponent");
      prefs.put(text.getName(), text.getText());
    }
  };
    
  public static void track(JSplitPane split) {
    Preferences prefs = node().node("JSplitPane");

    // restore the previous location
    int dividerLocation =
      prefs.getInt(split.getName() + ".dividerLocation", -1);
    if (dividerLocation >= 0) {
      split.setDividerLocation(dividerLocation);
    }

    // track changes
    split.addPropertyChangeListener(
      JSplitPane.DIVIDER_LOCATION_PROPERTY,
      splitPaneListener);
  }

  private static PropertyChangeListener splitPaneListener =
    new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      JSplitPane split = (JSplitPane)evt.getSource();
      node().node("JSplitPane").put(
        split.getName() + ".dividerLocation",
        String.valueOf(split.getDividerLocation()));
    }
  };

  /**
   * @return the Preference node where User Preferences are stored.
   */
  private static Preferences node() {
    return Preferences.userNodeForPackage(UserPreferences.class).node(
      "UserPreferences");
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷av一区二区三区大白胸| 午夜精品123| 99精品偷自拍| 亚洲bt欧美bt精品| 亚洲电影第三页| 青青草一区二区三区| 亚洲第一成年网| 色婷婷综合五月| 91精品在线麻豆| 精品亚洲aⅴ乱码一区二区三区| 日韩午夜精品电影| 青青草原综合久久大伊人精品优势| 欧美日韩国产影片| 久久er99精品| 成人app软件下载大全免费| 成人免费视频一区| 欧美性生活影院| 精品国产一区二区在线观看| 在线91免费看| 欧美剧情电影在线观看完整版免费励志电影| 在线观看日韩av先锋影音电影院| 在线视频一区二区三| 国产欧美一区二区在线| 日本欧美肥老太交大片| 成人一区在线观看| 亚洲精品在线观看网站| 丰满少妇在线播放bd日韩电影| 中文欧美字幕免费| 欧美日韩国产精品自在自线| 亚洲成人综合视频| 国产一区二区在线视频| 国产精品小仙女| 日本vs亚洲vs韩国一区三区二区| 日韩欧美国产午夜精品| 成人av资源在线| 亚洲高清不卡在线观看| 国产欧美日韩精品在线| 欧美日韩国产欧美日美国产精品| 国产伦精品一区二区三区视频青涩| 成人欧美一区二区三区白人| 欧美一卡2卡3卡4卡| 91丨九色丨蝌蚪富婆spa| 乱一区二区av| 亚洲大片在线观看| 欧美韩日一区二区三区四区| 欧美一卡二卡三卡四卡| 日本高清不卡视频| 国产成a人无v码亚洲福利| 天天av天天翘天天综合网 | 成人在线一区二区三区| 亚洲资源在线观看| 国产精品毛片大码女人| 日韩一区国产二区欧美三区| 色8久久精品久久久久久蜜| 国产一区不卡在线| 日韩av高清在线观看| 亚洲小少妇裸体bbw| 日本一二三四高清不卡| www精品美女久久久tv| 欧美国产乱子伦| www.亚洲国产| 国产精品久久久久影院色老大| 在线视频综合导航| 中文字幕亚洲综合久久菠萝蜜| 99久久精品免费| 久久国产精品99久久人人澡| 欧美国产精品专区| 欧美日韩国产高清一区二区| 亚洲女厕所小便bbb| 国产网红主播福利一区二区| 日韩免费看的电影| 欧美二区三区的天堂| 色婷婷一区二区| 91色.com| 色综合久久中文综合久久牛| 成人av资源站| 99久久精品国产精品久久| 成人在线视频一区| 不卡的电影网站| 97成人超碰视| 色激情天天射综合网| 91精品1区2区| 欧洲一区二区三区免费视频| 欧美综合一区二区| 欧美色网站导航| 欧美精品亚洲二区| 日韩欧美国产成人一区二区| 欧美大胆一级视频| 精品播放一区二区| 欧美经典一区二区| 国产精品电影院| 亚洲激情自拍视频| 五月天久久比比资源色| 日韩电影免费在线看| 国产最新精品精品你懂的| 国产精一区二区三区| 99热这里都是精品| 欧美最猛性xxxxx直播| 欧美精品粉嫩高潮一区二区| 欧美一卡在线观看| 国产日产精品一区| 视频一区二区不卡| 有坂深雪av一区二区精品| 国产精品初高中害羞小美女文| 国产精品久久精品日日| 亚洲精品国产高清久久伦理二区| 99久久99久久精品免费观看| av亚洲精华国产精华| 日本精品一级二级| 欧美tickling挠脚心丨vk| 久久新电视剧免费观看| 中文字幕一区二区日韩精品绯色| 伊人性伊人情综合网| 久久精品国产澳门| 99精品久久99久久久久| 欧美精品vⅰdeose4hd| 国产午夜一区二区三区| 五月婷婷欧美视频| 国内精品视频666| 色婷婷av久久久久久久| 日韩欧美中文字幕精品| 日韩av不卡在线观看| 国产成人自拍网| 在线观看日韩电影| 美女一区二区在线观看| 97国产精品videossex| 亚洲国产高清不卡| 国产成人av影院| 一区二区理论电影在线观看| 99精品偷自拍| 亚洲精品中文字幕在线观看| 91免费视频大全| 国产精品美女久久久久久| 制服丝袜日韩国产| 一区二区三区四区激情| 91亚洲精品一区二区乱码| 欧美zozo另类异族| 日本中文在线一区| 91精品国产色综合久久不卡电影 | 中文字幕乱码久久午夜不卡 | 中文字幕一区av| 久久99精品久久久久久久久久久久| 91美女视频网站| 日韩欧美电影在线| 亚洲制服丝袜av| 99v久久综合狠狠综合久久| 精品对白一区国产伦| 午夜电影一区二区| 日本电影欧美片| 亚洲欧洲www| 成人免费看黄yyy456| 精品国产乱码久久久久久蜜臀 | 国产一区二三区| 日韩欧美视频一区| 首页综合国产亚洲丝袜| 色综合激情五月| 99久久精品免费| 亚洲最快最全在线视频| 欧美日韩精品一区二区三区四区 | 欧美videofree性高清杂交| 亚洲永久精品大片| 日韩一级二级三级| 亚洲五码中文字幕| 国产精品视频看| 欧美一区二区三区四区五区 | 日韩视频免费观看高清完整版在线观看 | 亚洲精品第1页| 成人av电影在线网| 国产精品乱人伦| 风间由美一区二区av101| 在线日韩一区二区| 激情综合网最新| 久久先锋影音av鲁色资源| 在线一区二区三区四区五区| 国产麻豆日韩欧美久久| 亚洲一区二区三区中文字幕在线| 国产视频一区二区在线| 在线电影国产精品| av色综合久久天堂av综合| 欧美日韩精品一区二区三区蜜桃 | 蜜桃视频在线观看一区二区| 欧美日韩一区二区电影| 一区二区三区欧美视频| 欧美日韩一区在线观看| 日韩国产在线一| 欧美成人vr18sexvr| 国产真实乱偷精品视频免| 国产午夜亚洲精品不卡| 99re亚洲国产精品| 亚洲成人自拍一区| 久久婷婷国产综合国色天香| 国产成人一级电影| 亚洲精品亚洲人成人网| 欧美日韩国产一级片| 久久99精品久久久久| 国产精品福利一区| 在线不卡的av| 国产精品一区二区无线| 亚洲精品视频自拍| 日韩一区二区三区精品视频|