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

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

?? pcombobox.java

?? 更方便的SWING
?? JAVA
字號:
/*
 * PSwing Utilities -- Nifty Swing Widgets
 * Copyright (C) 2002  Pallas Technology
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 * Pallas Technology
 * 1170 HOWELL MILL RD NW
 * SUITE 306
 * ATLANTA GEORGIA 30318
 * 
 * PHONE 404.983.0623
 * EMAIL info@pallastechnology.com
 * 
 * www.pallastechnology.com
 **************************************************************************
 * $Archive: SwingTools$
 * $FileName: PComboBox.java$
 * $FileID: 3$
 *
 * Last change:
 * $AuthorName: Rob MacGrogan$
 * $Date: 8/1/03 1:22 PM$
 * $VerID: 86$
 * $Comment: Debug array index error when PComboBox contains no items.$
 **************************************************************************/
package com.pallas.swing.pcombobox;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JTextField;

/**
 * Title:   $FileName: PComboBox.java$
 * @version $VerNum: 11$
 * @author $AuthorName: Rob MacGrogan$<br><br>
 * 
 * $Description: Nifty Swing combobox that functions like the
 *              standard non-web browser combo box people are used to
 *              seeing.$<br>
 * $KeyWordsOff: $<br><br>
 *
 * Nifty Swing combobox that functions like the standard non-web browser combo box
 * people are used to seeing. User types the viewable string of the item they want
 * to select and the closest match will be selected, instead of the default Java
 * functionality which only looks at the first letter of each string in the list.
 */
public class PComboBox extends JComboBox implements PCombo {

  private Vector itemIndex = new Vector();
  private Hashtable listLocationIndex = new Hashtable();
  private FullWordComboKeySelectionModel mgr = null;
  private boolean allowNewEntries = false;

  /**
   * Constructor for PComboBox.
   * @param aModel
   */
  public PComboBox(ComboBoxModel aModel) {
    super(aModel);
    //initializeComponent();
  }

  /**
   * Constructor for PComboBox.
   * @param items
   */
  public PComboBox(Object[] items) {
    super(items);
    //initializeComponent();
  }

  /**
   * Constructor for PComboBox.
   * @param items
   */
  public PComboBox(Vector items) {
    super(items);
    //initializeComponent();
  }

  /**
   * Constructor for PComboBox.
   */
  public PComboBox() {
    super();
    //initializeComponent();
  }

  public Enumeration getUpperCaseContents(){
    return listLocationIndex.keys();
  }

  /**
   * Must be called after all items have been added to combo box, or after a new
   * item is added. This indexes all items String values for fast
   * searching and matching.<br><br>
   *
   * PComboBox WILL NOT WORK IF YOU DO NOT CALL THIS METHOD.
   */
  public synchronized void buildIndex(){
    ComboBoxModel model = getModel();
    itemIndex = new Vector();
    listLocationIndex = new Hashtable();
    for (int i = 0; i < model.getSize(); i++){
      Object o = model.getElementAt(i);
      itemIndex.add(o);
      listLocationIndex.put(o.toString().toUpperCase(), new Integer(i));
    }
    Collections.sort(itemIndex, new ToStringComparator());
  }

  public boolean containsDisplayString(String s){
    int i = search(s);
    boolean contains = false;
    if (i >= 0){
      contains = true;
    }
    return contains;
  }

  /**
   * Selects the first item in the list where itemInList.equals(item).
   * Returns the itemInList.
   */
  public Object setSelectedItemByValue(Object item){
    //Brute force search for now.
    Iterator itr = itemIndex.iterator();
    Object foundItem = null;
    while(itr.hasNext() && foundItem == null){
      Object o = itr.next();
      if (o.equals(item)){
        foundItem = o;
      }
    }
    setSelectedItem(foundItem);
    return foundItem;
  }


  /**
   * Returns the index of the first item in the list that matches
   * the passed in string. A match is made if the first <code>x</code>
   * letters of the item match the search string, where <code>x</code>
   * is the length of the search string.
   */
  public int search(String search){
    int listLocation = -1;
      
    if (itemIndex.size() > 0){
      String s = search.toUpperCase();
  //System.out.println("[C] search for: " + s);
  
      int iBeginSearchRange = 0;
      int iEndSearchRange = itemIndex.size() - 1;
  
      //First, let's check index 0.
      Object oZ = itemIndex.get(0);
      int compZ = compareStrings(s, oZ.toString());
      if (compZ == 0){
        //Index 0 matches.
        listLocation = 0;
      }
      else{
        while (iEndSearchRange != iBeginSearchRange){
          int iRange = (iEndSearchRange - iBeginSearchRange) + 1;
          int iCheckPoint = iBeginSearchRange + (iRange / 2);
  //System.out.println("[C] begin: " + iBeginSearchRange);
  //System.out.println("[C] end: " + iEndSearchRange);
  //System.out.println("[C] check: " + iCheckPoint);
          Object o = itemIndex.get(iCheckPoint);
  //System.out.println("[C] checking: " + o);
          int comp = compareStrings(s, o.toString());
  //System.out.println("[C] comp: " + comp);
          if (comp == 0){
            //We've got a likely match.
            listLocation = iCheckPoint;
            //This will bump us out of the loop.
            iEndSearchRange = iBeginSearchRange;
          }
          else if (comp == 1){
            //search value must be after checkpoint.
            iBeginSearchRange = iCheckPoint;
          }
          else{
            //search value is before checkpoint.
            iEndSearchRange = iCheckPoint - 1;
          }
        }//end while
      }//end else index 0 does not match.
      if (listLocation != -1){
        listLocation = getBestMatchIndex(s, itemIndex.get(listLocation).toString(), listLocation);
      }
    }
    return listLocation;
  }

  /**
   * Double checks list for an exact match of search.
   */
  private int getBestMatchIndex(String search, String item, int listLocation){
    int bestMatchIndex = -1;
    String searchItem = item.toUpperCase();

    if (search.length() < searchItem.length() &&
        listLocationIndex.containsKey(search)){
      //For now, just look for exact match of search.
      Integer intLoc = (Integer)listLocationIndex.get(search);
      bestMatchIndex = intLoc.intValue();
    }
    else{
      //listLocation is it.
      Integer intLoc = (Integer)listLocationIndex.get(itemIndex.get(listLocation).toString().toUpperCase());
      bestMatchIndex = intLoc.intValue();
    }
    return bestMatchIndex;
  }


  /**
   * Returns -1, 0, or 1
   */
  private int compareStrings(String search, String item){
//System.out.println("[C] item: " + item);
    int comp = 0;
    String sBeginItem = item;
    if (item.length() >= search.length()){
      sBeginItem = item.substring(0, search.length());
    }
    if (sBeginItem.equalsIgnoreCase(search)){
      comp = 0;
    }
    else if (ToStringComparator.firstStringSortsBeforeSecond(search, sBeginItem, false)){
      comp = -1;
    }
    else{
      comp = 1;
    }
    return comp;
  }

  /**
   * Initializes the PComboBox.
   */
  protected void initializeComponent(){
    super.setEditable(true);
    //getEditor();
    mgr = new FullWordComboKeySelectionModel(this);
    setKeySelectionManager(mgr);

    getEditor().getEditorComponent().addFocusListener(new PComboFocusListener(mgr));
  }

  public void updateUI(){
    super.updateUI();
    //Update key selection.
    initializeComponent();
  }


  /**
   * This method does nothing. PComboBox always uses FullWordComboKeySelectionModel.
   */
  public void setKeySelectionManager(JComboBox.KeySelectionManager manager){
  }

  /**
   * This method does nothing. PComboBox is always editable.
   */
  public void setEditable(boolean editable){
    //Do nothing.
  }

  /**
   * Returns the editor component of the PComboBox.
   */
  public JTextField getTextField(){
    return (JTextField)(getEditor().getEditorComponent());
  }


  /**
   * Selects the item with the specified display string. If the
   * display string does not occur in the combo box, nothing happens.
   */
  public void setSelectionByDisplay(String display){
    display = display.toUpperCase();
    Integer index = (Integer)listLocationIndex.get(display);
    if (index != null){
      int iIndex = index.intValue();
      setSelectedIndex(iIndex);
    }
  }

  /**
   * Returns the allowNewEntries.
   * @return boolean
   */
  public boolean isAllowNewEntries() {
    return allowNewEntries;
  }

  /**
   * Sets the allowNewEntries.
   * @param allowNewEntries The allowNewEntries to set
   */
  public void setAllowNewEntries(boolean allowNewEntries) {
    this.allowNewEntries = allowNewEntries;
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区女| 日韩一区二区免费在线电影| 国产福利精品一区二区| 久久国产福利国产秒拍| 免费人成精品欧美精品 | 日本va欧美va精品| 丝袜美腿一区二区三区| 天天射综合影视| 亚洲国产婷婷综合在线精品| 亚洲1区2区3区视频| 亚洲成人在线免费| 日韩国产欧美在线视频| 麻豆国产欧美一区二区三区| 久久av老司机精品网站导航| 狠狠色丁香婷婷综合| 狠狠久久亚洲欧美| 福利一区二区在线| 97aⅴ精品视频一二三区| 国产成人精品午夜视频免费| 国精品**一区二区三区在线蜜桃| 国产一区二区三区免费看 | 欧美日韩国产小视频在线观看| 欧洲精品在线观看| 7777精品伊人久久久大香线蕉完整版 | 日韩欧美一级二级三级久久久| 欧美一区二区久久久| 日韩一级片在线观看| 久久久影视传媒| 国产精品进线69影院| 一区二区三区在线观看国产| 午夜精品久久久久久久99水蜜桃 | 欧美一区中文字幕| 久久久不卡网国产精品一区| 中文字幕在线一区| 亚洲午夜免费福利视频| 欧美午夜免费电影| 5月丁香婷婷综合| 国产亚洲成年网址在线观看| 亚洲丝袜制服诱惑| 日韩不卡手机在线v区| 国产精品一区免费视频| 色天使色偷偷av一区二区| 欧美一区二区三区免费大片| 久久精品在线观看| 亚洲第一久久影院| 国产高清在线观看免费不卡| 色综合色狠狠综合色| 日韩欧美在线网站| 亚洲日本一区二区| 久久99热狠狠色一区二区| 91在线观看成人| 欧美变态口味重另类| 日韩理论片网站| 精品亚洲国产成人av制服丝袜 | 国产丝袜欧美中文另类| 亚洲国产成人精品视频| 国产成人av自拍| 91精品国产欧美一区二区18 | 麻豆91小视频| 色狠狠一区二区| 国产日本亚洲高清| 日韩黄色一级片| 91毛片在线观看| 国产欧美精品一区二区三区四区| 五月综合激情婷婷六月色窝| 成人av电影免费在线播放| 日韩欧美一级精品久久| 亚洲一区国产视频| 成人免费看视频| 精品乱码亚洲一区二区不卡| 亚洲综合激情小说| av一区二区三区四区| 久久综合狠狠综合久久综合88| 亚洲一区二区三区影院| k8久久久一区二区三区| 久久精品亚洲精品国产欧美kt∨ | 日韩欧美一级在线播放| 亚洲一区在线观看视频| 菠萝蜜视频在线观看一区| 久久久久免费观看| 久久精品国产秦先生| 欧美日韩一区二区不卡| 亚洲乱码一区二区三区在线观看| 国产精品888| 精品sm捆绑视频| 蜜臀精品一区二区三区在线观看 | 色老汉av一区二区三区| 中文字幕一区二区三区精华液| 国产一区欧美二区| 日韩欧美二区三区| 日本va欧美va欧美va精品| 777午夜精品免费视频| 亚洲成av人影院| 欧美三级视频在线| 亚洲国产精品人人做人人爽| 99re这里只有精品首页| 国产精品不卡在线观看| thepron国产精品| 1000部国产精品成人观看| 福利91精品一区二区三区| 国产日产欧产精品推荐色| 国产成人欧美日韩在线电影| 久久美女艺术照精彩视频福利播放| 麻豆高清免费国产一区| 日韩精品一区二区三区在线播放| 日本中文字幕一区二区有限公司| 欧美午夜精品理论片a级按摩| 亚洲最大色网站| 91麻豆精品国产| 蜜臀av国产精品久久久久| 欧美tk—视频vk| 国产精品伊人色| 国产精品天干天干在观线| www.欧美色图| 亚洲福利视频一区二区| 欧美精品vⅰdeose4hd| 免费成人在线观看视频| 亚洲精品在线三区| 国产黄色精品网站| 中文字幕一区二区三区在线不卡| 日本韩国精品在线| 五月天激情综合网| 日韩美女一区二区三区四区| 国产真实乱子伦精品视频| 国产精品无圣光一区二区| 色中色一区二区| 天涯成人国产亚洲精品一区av| 日韩欧美亚洲国产另类| 国产成人三级在线观看| 亚洲欧美二区三区| 91精品免费在线| 国产精品一二三| 亚洲美女免费在线| 91精品国产色综合久久ai换脸 | 看电视剧不卡顿的网站| 国产欧美一区二区精品忘忧草| 国产91精品免费| 亚洲最大的成人av| 日韩欧美电影一二三| 成人国产亚洲欧美成人综合网| 一片黄亚洲嫩模| 精品国产乱码久久久久久闺蜜 | 日韩欧美国产麻豆| 99re在线视频这里只有精品| 日韩电影在线观看一区| 久久久久99精品一区| 色www精品视频在线观看| 麻豆国产欧美日韩综合精品二区| 国产精品久久影院| 欧美老肥妇做.爰bbww| 国产麻豆精品久久一二三| 亚洲黄色性网站| 欧美电影精品一区二区| 91原创在线视频| 久久精品国产99久久6| 亚洲男人电影天堂| 精品国产sm最大网站免费看| 91女人视频在线观看| 久久99精品久久久久| 亚洲与欧洲av电影| 国产视频一区二区在线| 欧美高清视频一二三区| 成人动漫中文字幕| 国产一区二区三区蝌蚪| 日日摸夜夜添夜夜添亚洲女人| 国产精品国产三级国产普通话99 | 亚洲欧洲日韩在线| 精品剧情在线观看| 欧美视频一区在线| 成人午夜免费视频| 国内精品视频666| 色婷婷国产精品| 国产精品91xxx| 美女网站一区二区| 一区二区三区不卡视频| 亚洲国产激情av| 久久一区二区视频| 欧美区视频在线观看| 色综合中文字幕国产| 国产suv一区二区三区88区| 免费在线欧美视频| 图片区日韩欧美亚洲| 亚洲免费av观看| 中文字幕一区二区三中文字幕| 国产亚洲短视频| 久久在线免费观看| 日韩女优av电影在线观看| 欧美久久久一区| 日本高清不卡在线观看| 99久久精品免费看| 成人污污视频在线观看| 国产一区二区h| 精品一区二区三区蜜桃| 麻豆91在线播放| 另类小说欧美激情| 久久成人18免费观看| 麻豆精品视频在线观看免费| 日本sm残虐另类| 日韩国产高清在线| 免费成人在线观看视频|