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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? userpreferences.java

?? 精美開源Swing組件
?? JAVA
字號(hào):
/**
 * 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;

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");
  }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲永久免费视频| 国产精品国产自产拍在线| 日韩和欧美的一区| 91精品国产综合久久久久久久久久| 亚洲.国产.中文慕字在线| 欧美日韩精品电影| 久久精品国产一区二区| 国产三级精品在线| av资源网一区| 亚洲电影在线免费观看| 欧美一区二区三区免费视频| 精品一区免费av| 中国色在线观看另类| 色欧美片视频在线观看在线视频| 日日夜夜精品视频免费| 久久精品一区八戒影视| 色成人在线视频| 青青国产91久久久久久| 国产精品美女久久久久久久久久久 | 最新热久久免费视频| 欧美在线视频日韩| 国产尤物一区二区| 亚洲欧美日韩中文播放| 91精品国产91久久综合桃花| 国产成人综合自拍| 亚洲成年人影院| 欧美—级在线免费片| 欧美蜜桃一区二区三区| 丁香啪啪综合成人亚洲小说| 午夜日韩在线观看| 国产精品国模大尺度视频| 欧美一区二区三区思思人| www.欧美精品一二区| 蜜臀av一区二区在线免费观看| 中文字幕一区二区在线观看| 日韩欧美自拍偷拍| 欧美天堂亚洲电影院在线播放| 国产精品一区二区无线| 五月激情六月综合| 亚洲欧洲国产专区| 欧美精品一区二区三区蜜桃| 在线视频一区二区免费| 成人黄色综合网站| 激情伊人五月天久久综合| 亚洲高清中文字幕| 日韩理论片在线| 国产午夜精品理论片a级大结局| 欧美猛男gaygay网站| 成人黄色免费短视频| 极品美女销魂一区二区三区| 婷婷丁香激情综合| 一区二区三区精品视频| 国产精品高潮久久久久无| 日韩欧美一区二区在线视频| 欧美日韩一区久久| 在线一区二区三区| 成人app网站| 从欧美一区二区三区| 韩日精品视频一区| 日韩电影一二三区| 亚洲国产aⅴ成人精品无吗| 亚洲精品视频自拍| 亚洲少妇中出一区| 亚洲色图一区二区| 自拍偷拍亚洲激情| 国产精品久久免费看| 久久九九国产精品| 欧美精品一区二区三区四区 | 久久99久久久久久久久久久| 亚洲地区一二三色| 一区二区三区四区av| 亚洲精品中文字幕在线观看| 日韩一区在线看| 国产精品沙发午睡系列990531| 国产亚洲精品aa午夜观看| 久久蜜桃香蕉精品一区二区三区| 精品日本一线二线三线不卡| 制服丝袜亚洲色图| 9191久久久久久久久久久| 91精品国产欧美日韩| 日韩一区二区精品葵司在线 | 国产精品素人一区二区| 欧美国产视频在线| 中文字幕不卡在线播放| 最新国产成人在线观看| 一区二区日韩av| 亚洲国产一区二区a毛片| 午夜视频在线观看一区二区三区| 日本亚洲免费观看| 国产毛片一区二区| 91视频在线看| 欧美日韩成人综合在线一区二区| 91精品国产免费久久综合| 精品入口麻豆88视频| 国产精品美女久久福利网站| 一区二区三区在线视频观看| 亚洲一区精品在线| 久久国产尿小便嘘嘘| 成人小视频在线| 日本丶国产丶欧美色综合| 欧美电影影音先锋| 国产色婷婷亚洲99精品小说| 亚洲色图都市小说| 免费视频最近日韩| 成人av在线电影| 欧美日韩二区三区| 国产视频一区在线播放| 一区二区三区中文字幕| 久久国产精品第一页| 99热这里都是精品| 制服丝袜亚洲网站| 国产精品久久网站| 日本美女视频一区二区| 成人性生交大片免费看中文网站| 欧美伊人久久久久久久久影院| 欧美一区二区三级| 成人欧美一区二区三区白人| 天使萌一区二区三区免费观看| 国产一区二区三区在线观看精品| 色综合久久中文字幕综合网| 精品国产一区二区三区忘忧草| 亚洲美女少妇撒尿| 激情综合五月婷婷| 欧美日韩色综合| 国产女同性恋一区二区| 亚洲综合区在线| 成人午夜电影久久影院| 91精品中文字幕一区二区三区| 国产午夜一区二区三区| 首页国产欧美久久| 色综合色综合色综合色综合色综合| 欧美大片顶级少妇| 午夜私人影院久久久久| 丁香激情综合五月| 精品国产乱子伦一区| 婷婷综合在线观看| 色呦呦国产精品| 日本一区二区免费在线观看视频| 夜夜精品视频一区二区| 99麻豆久久久国产精品免费优播| 在线播放91灌醉迷j高跟美女| 亚洲特级片在线| 成人一区在线观看| 久久久蜜桃精品| 麻豆视频观看网址久久| 555www色欧美视频| 亚洲福利电影网| 色呦呦一区二区三区| 国产精品国产自产拍在线| 国产毛片精品国产一区二区三区| 欧美丰满少妇xxxxx高潮对白| 亚洲一区二区影院| 91视频91自| 日韩理论片网站| 99视频精品在线| 中文字幕日韩精品一区| 成人精品电影在线观看| 中文字幕免费一区| 韩国视频一区二区| 久久夜色精品一区| 国产一区激情在线| 欧美mv日韩mv国产| 狠狠狠色丁香婷婷综合久久五月| 日韩亚洲欧美中文三级| 日韩福利电影在线| 日韩欧美不卡一区| 老司机精品视频一区二区三区| 欧美日韩你懂得| 免费在线观看视频一区| 日韩一卡二卡三卡| 久久国产精品无码网站| 久久影院视频免费| 国产成都精品91一区二区三| 日本一区二区三区久久久久久久久不| 国产高清不卡二三区| 中文字幕亚洲在| 色欧美日韩亚洲| 亚洲成av人片在www色猫咪| 欧美丰满一区二区免费视频| 免费成人性网站| 久久久www免费人成精品| www.66久久| 亚洲一区二区三区在线看| 91精品国产高清一区二区三区 | 国产亚洲美州欧州综合国| 不卡视频免费播放| 亚洲无线码一区二区三区| 日韩视频免费观看高清完整版在线观看| 老司机午夜精品99久久| 欧美精品一区二区精品网| 成人午夜激情在线| 一区二区免费在线| 精品少妇一区二区三区免费观看 | 欧美揉bbbbb揉bbbbb| 日韩av中文字幕一区二区三区| 精品国产一区久久| 一本一本久久a久久精品综合麻豆| 天堂精品中文字幕在线| 国产午夜精品福利| 欧美性受xxxx|