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

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

?? elementtreepanel.java

?? 一個小公司要求給寫的很簡單的任務管理系統。
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * @(#)ElementTreePanel.java	1.17 05/11/17 *  * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: *  * -Redistribution of source code must retain the above copyright notice, this *  list of conditions and the following disclaimer. *  * -Redistribution in binary form must reproduce the above copyright notice,  *  this list of conditions and the following disclaimer in the documentation *  and/or other materials provided with the distribution. *  * Neither the name of Sun Microsystems, Inc. or the names of contributors may  * be used to endorse or promote products derived from this software without  * specific prior written permission. *  * This software is provided "AS IS," without a warranty of any kind. ALL  * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE * AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST  * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,  * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY  * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. *  * You acknowledge that this software is not designed, licensed or intended * for use in the design, construction, operation or maintenance of any * nuclear facility. *//* * @(#)ElementTreePanel.java	1.17 05/11/17 */import javax.swing.*;import javax.swing.event.*;import javax.swing.text.*;import javax.swing.tree.*;import javax.swing.undo.*;import java.awt.*;import java.beans.*;import java.util.*;/** * Displays a tree showing all the elements in a text Document. Selecting * a node will result in reseting the selection of the JTextComponent. * This also becomes a CaretListener to know when the selection has changed * in the text to update the selected item in the tree. * * @author Scott Violet * @version 1.17 11/17/05 */public class ElementTreePanel extends JPanel implements CaretListener, DocumentListener, PropertyChangeListener, TreeSelectionListener {    /** Tree showing the documents element structure. */    protected JTree             tree;    /** Text component showing elemenst for. */    protected JTextComponent    editor;    /** Model for the tree. */    protected ElementTreeModel  treeModel;    /** Set to true when updatin the selection. */    protected boolean           updatingSelection;    public ElementTreePanel(JTextComponent editor) {	this.editor = editor;	Document document = editor.getDocument();	// Create the tree.	treeModel = new ElementTreeModel(document);	tree = new JTree(treeModel) {	    public String convertValueToText(Object value, boolean selected,					     boolean expanded, boolean leaf,					     int row, boolean hasFocus) {		// Should only happen for the root		if(!(value instanceof Element))		    return value.toString();		Element        e = (Element)value;		AttributeSet   as = e.getAttributes().copyAttributes();		String         asString;		if(as != null) {		    StringBuffer       retBuffer = new StringBuffer("[");		    Enumeration        names = as.getAttributeNames();		    while(names.hasMoreElements()) {			Object        nextName = names.nextElement();			if(nextName != StyleConstants.ResolveAttribute) {			    retBuffer.append(" ");			    retBuffer.append(nextName);			    retBuffer.append("=");			    retBuffer.append(as.getAttribute(nextName));			}		    }		    retBuffer.append(" ]");		    asString = retBuffer.toString();		}		else		    asString = "[ ]";		if(e.isLeaf())		    return e.getName() + " [" + e.getStartOffset() +			", " + e.getEndOffset() +"] Attributes: " + asString;		return e.getName() + " [" + e.getStartOffset() +		    ", " + e.getEndOffset() + "] Attributes: " + 		        asString;	    }	};	tree.addTreeSelectionListener(this);	tree.setDragEnabled(true);	// Don't show the root, it is fake.	tree.setRootVisible(false);	// Since the display value of every node after the insertion point	// changes every time the text changes and we don't generate a change	// event for all those nodes the display value can become off.	// This can be seen as '...' instead of the complete string value.	// This is a temporary workaround, increase the needed size by 15,	// hoping that will be enough.	tree.setCellRenderer(new DefaultTreeCellRenderer() {	    public Dimension getPreferredSize() {		Dimension retValue = super.getPreferredSize();		if(retValue != null)		    retValue.width += 15;		return retValue;	    }	});	// become a listener on the document to update the tree.	document.addDocumentListener(this);	// become a PropertyChangeListener to know when the Document has	// changed.	editor.addPropertyChangeListener(this);	// Become a CaretListener	editor.addCaretListener(this);	// configure the panel and frame containing it.	setLayout(new BorderLayout());	add(new JScrollPane(tree), BorderLayout.CENTER);	// Add a label above tree to describe what is being shown	JLabel     label = new JLabel("Elements that make up the current document", SwingConstants.CENTER);	label.setFont(new Font("Dialog", Font.BOLD, 14));	add(label, BorderLayout.NORTH);	setPreferredSize(new Dimension(400, 400));    }    /**     * Resets the JTextComponent to <code>editor</code>. This will update     * the tree accordingly.     */    public void setEditor(JTextComponent editor) {	if (this.editor == editor) {	    return;	}	if (this.editor != null) {	    Document      oldDoc = this.editor.getDocument();	    oldDoc.removeDocumentListener(this);	    this.editor.removePropertyChangeListener(this);	    this.editor.removeCaretListener(this);	}	this.editor = editor;	if (editor == null) {	    treeModel = null;	    tree.setModel(null);	}	else {	    Document   newDoc = editor.getDocument();	    newDoc.addDocumentListener(this);	    editor.addPropertyChangeListener(this);	    editor.addCaretListener(this);	    treeModel = new ElementTreeModel(newDoc);	    tree.setModel(treeModel);	}    }    // PropertyChangeListener    /**     * Invoked when a property changes. We are only interested in when the     * Document changes to reset the DocumentListener.     */    public void propertyChange(PropertyChangeEvent e) {	if (e.getSource() == getEditor() &&	    e.getPropertyName().equals("document")) {	    JTextComponent      editor = getEditor();	    Document            oldDoc = (Document)e.getOldValue();	    Document            newDoc = (Document)e.getNewValue();	    // Reset the DocumentListener	    oldDoc.removeDocumentListener(this);	    newDoc.addDocumentListener(this);	    // Recreate the TreeModel.	    treeModel = new ElementTreeModel(newDoc);	    tree.setModel(treeModel);	}    }    // DocumentListener    /**     * Gives notification that there was an insert into the document.  The     * given range bounds the freshly inserted region.     *     * @param e the document event     */    public void insertUpdate(DocumentEvent e) {	updateTree(e);    }    /**     * Gives notification that a portion of the document has been     * removed.  The range is given in terms of what the view last     * saw (that is, before updating sticky positions).     *     * @param e the document event     */    public void removeUpdate(DocumentEvent e) {	updateTree(e);    }    /**     * Gives notification that an attribute or set of attributes changed.     *     * @param e the document event     */    public void changedUpdate(DocumentEvent e) {	updateTree(e);    }    // CaretListener    /**     * Messaged when the selection in the editor has changed. Will update     * the selection in the tree.     */    public void caretUpdate(CaretEvent e) {	if(!updatingSelection) {	    JTextComponent     editor = getEditor();	    int                selBegin = Math.min(e.getDot(), e.getMark());	    int                end = Math.max(e.getDot(), e.getMark());	    Vector             paths = new Vector();	    TreeModel          model = getTreeModel();	    Object             root = model.getRoot();	    int                rootCount = model.getChildCount(root);	    // Build an array of all the paths to all the character elements	    // in the selection.	    for(int counter = 0; counter < rootCount; counter++) {		int            start = selBegin;		while(start <= end) {		    TreePath    path = getPathForIndex(start, root,				       (Element)model.getChild(root, counter));		    Element     charElement = (Element)path.			                       getLastPathComponent();		    paths.addElement(path);		    if(start >= charElement.getEndOffset())			start++;		    else			start = charElement.getEndOffset();		}	    }	    // If a path was found, select it (them).	    int               numPaths = paths.size();	    if(numPaths > 0) {		TreePath[]    pathArray = new TreePath[numPaths];		paths.copyInto(pathArray);		updatingSelection = true;		try {		    getTree().setSelectionPaths(pathArray);		    getTree().scrollPathToVisible(pathArray[0]);		}		finally {		    updatingSelection = false;		}	    }	}    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美综合在线| 美国欧美日韩国产在线播放| 国产suv精品一区二区6| 国产农村妇女毛片精品久久麻豆| 91蜜桃网址入口| 国产精品国产三级国产普通话三级| 欧美成人乱码一区二区三区| 日韩国产成人精品| 91精品麻豆日日躁夜夜躁| 日韩精品电影在线观看| 精品国产伦理网| 成人免费黄色大片| 一个色综合网站| 欧美久久久久久久久| 国产在线精品一区二区不卡了| 色婷婷综合久久久中文一区二区| 精品sm捆绑视频| 成人av资源在线| 亚洲不卡一区二区三区| 精品久久久久久最新网址| 丁香一区二区三区| 性做久久久久久| 日韩免费看的电影| 色先锋aa成人| 蜜臂av日日欢夜夜爽一区| 中文字幕av资源一区| 欧美日韩高清一区二区| 国产一区三区三区| 一区二区三区不卡在线观看| 精品国产a毛片| 欧美在线短视频| 国产成人精品免费视频网站| 夜夜嗨av一区二区三区网页 | 69久久99精品久久久久婷婷| 激情综合五月天| 亚洲一区二区精品3399| 久久精品亚洲一区二区三区浴池 | 久久精子c满五个校花| 欧美伊人精品成人久久综合97| 国产精品国产a级| 欧美www视频| 欧美日韩一区在线观看| 成人免费视频app| 久久精品国产**网站演员| 亚洲一区自拍偷拍| 国产精品欧美一区喷水| 精品国产一区二区亚洲人成毛片| 亚洲福利视频导航| 国产精品美女一区二区三区 | 国产成人免费视频精品含羞草妖精| 精品国产乱码久久久久久影片| 麻豆精品久久久| 亚洲国产精品久久久久婷婷884| 欧美日韩中字一区| 91丨九色丨蝌蚪富婆spa| 国产91清纯白嫩初高中在线观看| 国产午夜精品一区二区三区四区| 国产成人aaa| 韩国三级在线一区| 免费视频一区二区| 亚洲bt欧美bt精品| 亚洲曰韩产成在线| 亚洲同性gay激情无套| 国产精品麻豆网站| 国产清纯白嫩初高生在线观看91 | 成人深夜在线观看| 国产在线精品免费| 日韩影院精彩在线| 亚洲成av人**亚洲成av**| 一区二区三区欧美| 夜夜嗨av一区二区三区| 一区二区三区精品久久久| 亚洲人一二三区| 亚洲欧美激情插| 中文字幕日韩一区二区| 综合色天天鬼久久鬼色| 亚洲欧美日韩在线不卡| 日韩伦理av电影| 亚洲欧美一区二区三区孕妇| 最新日韩av在线| 亚洲欧洲日韩av| 一区二区三区国产| 亚洲v精品v日韩v欧美v专区| 天堂一区二区在线| 麻豆91在线播放免费| 久久精品国产99久久6| 久久99精品久久久久久动态图| 亚洲欧美视频在线观看| 中文字幕一区在线| 亚洲一区二区三区影院| 亚洲午夜精品17c| 免费一级片91| 国产很黄免费观看久久| 精品人在线二区三区| 日韩视频不卡中文| 精品处破学生在线二十三| 精品国产1区二区| www激情久久| 久久久国产综合精品女国产盗摄| 亚洲在线视频一区| 首页综合国产亚洲丝袜| 精品亚洲aⅴ乱码一区二区三区| 国产精品人人做人人爽人人添| 欧美在线免费观看视频| 欧美一二三四在线| 国产精品水嫩水嫩| 午夜精品在线看| 国产精品一区专区| 91麻豆精品在线观看| 日韩午夜av电影| 国产精品日韩成人| 午夜精品久久久久久久 | 精品久久久影院| 国产精品久久久久桃色tv| 亚洲一区二区精品视频| 国产一区91精品张津瑜| 欧美曰成人黄网| 精品粉嫩超白一线天av| 1024国产精品| 激情综合色综合久久综合| 色综合色狠狠综合色| 精品久久久久香蕉网| 一区二区三区视频在线观看| 黑人巨大精品欧美黑白配亚洲| 裸体在线国模精品偷拍| 91尤物视频在线观看| 久久久影院官网| 午夜视频在线观看一区二区| 国产成人在线影院| 欧美一卡二卡在线| 亚洲美女偷拍久久| 国产一区二区免费在线| 制服丝袜成人动漫| 1024成人网| 国产1区2区3区精品美女| 欧美一区二区久久| 亚洲自拍另类综合| 成人动漫中文字幕| 精品国产百合女同互慰| 免费三级欧美电影| 欧美色老头old∨ideo| 国产精品久久久久久久浪潮网站 | 欧美三级一区二区| 国产精品成人免费| 国产精品18久久久久久久网站| 国产一区在线观看视频| 3d动漫精品啪啪一区二区竹菊| 欧美午夜精品免费| 椎名由奈av一区二区三区| 经典三级一区二区| 欧美r级在线观看| 日韩av不卡一区二区| 在线看日韩精品电影| 亚洲天堂免费看| 99re这里只有精品6| 国产精品不卡一区| 99国产精品久久久| 国产精品嫩草影院av蜜臀| 国产suv精品一区二区6| 国产日韩欧美综合在线| 精品国产乱码久久久久久闺蜜| 国产夜色精品一区二区av| 国产精品一级黄| 免费人成精品欧美精品| 亚洲欧美自拍偷拍色图| va亚洲va日韩不卡在线观看| 日本女优在线视频一区二区| 日韩视频一区在线观看| 免费成人av在线播放| 亚洲另类春色校园小说| 亚洲国产岛国毛片在线| 精品成a人在线观看| 久久免费偷拍视频| 日本一区二区三区四区| 久久久久久久久99精品| 中文字幕巨乱亚洲| 亚洲婷婷综合色高清在线| 亚洲精品国产高清久久伦理二区| 精品亚洲免费视频| 天天操天天干天天综合网| 一区二区成人在线| 日韩国产欧美三级| 国产成人在线色| 色偷偷久久人人79超碰人人澡| 国产精品久久久久婷婷| 亚洲伦理在线免费看| 日本亚洲三级在线| 亚洲欧美成人一区二区三区| 亚洲国产精品一区二区久久恐怖片| 日韩午夜精品视频| 欧美激情在线一区二区| 午夜精品久久久久久久| 国产不卡免费视频| 在线一区二区视频| 精品国产99国产精品| 午夜久久电影网| 波多野结衣一区二区三区 | 国产精品传媒在线| 亚洲国产综合色| 一本色道综合亚洲|