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

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

?? elementtreepanel.java

?? 一個小公司要求給寫的很簡單的任務(wù)管理系統(tǒng)。
?? 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;		}	    }	}    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清中文字幕| 日本一区二区不卡视频| 精品噜噜噜噜久久久久久久久试看| av亚洲精华国产精华精华 | 免费成人av在线| 婷婷久久综合九色综合绿巨人| 亚洲欧美日韩国产手机在线| 日韩高清电影一区| 国产一区视频网站| 久久黄色级2电影| 91免费看片在线观看| 91.com视频| 国产亚洲美州欧州综合国| 国产精品短视频| 性久久久久久久| 99久久精品免费| 精品国产91久久久久久久妲己 | 精品亚洲porn| 91麻豆精品一区二区三区| 99视频国产精品| 欧美不卡激情三级在线观看| 国产精品对白交换视频| 日韩高清电影一区| 色综合天天做天天爱| 欧美日韩免费高清一区色橹橹| 欧美激情一区在线观看| 久久成人av少妇免费| 99久久99久久免费精品蜜臀| 久久久精品中文字幕麻豆发布| 亚洲国产精品久久艾草纯爱| 懂色一区二区三区免费观看| 久久综合五月天婷婷伊人| 一区二区三区色| 91啪亚洲精品| 日韩美女视频19| 大白屁股一区二区视频| 精品乱人伦小说| 国产.欧美.日韩| 日韩女优av电影| 国产一区二区三区国产| 欧美一区二区三区四区五区| 一区二区三区四区不卡在线 | 久久影院视频免费| 老司机一区二区| 欧美一级xxx| 成人激情综合网站| 一区二区三区在线视频免费 | 国产精品入口麻豆原神| 国产精品正在播放| 亚洲婷婷综合久久一本伊一区| 99国产精品久| 亚洲一区在线免费观看| 日韩午夜电影在线观看| 成人网在线免费视频| 亚洲码国产岛国毛片在线| 在线视频亚洲一区| 国内成人自拍视频| 一片黄亚洲嫩模| 国产欧美日韩不卡| 欧美日韩国产色站一区二区三区| 韩国成人精品a∨在线观看| 久久久精品天堂| 欧美日韩亚洲高清一区二区| 国产一区二区三区四区五区入口 | www.久久久久久久久| 奇米精品一区二区三区在线观看一 | 制服.丝袜.亚洲.另类.中文| 成人三级在线视频| 国产综合久久久久久久久久久久| 亚洲精选视频在线| 欧美变态tickling挠脚心| 日本韩国欧美在线| 色婷婷综合久久久中文字幕| 国产精品一区二区三区网站| 亚洲电影你懂得| 国产精品久久毛片| 国产精品久久久一本精品 | proumb性欧美在线观看| 国产老肥熟一区二区三区| 婷婷久久综合九色综合绿巨人| 一区二区三区四区av| 亚洲自拍偷拍网站| 日韩毛片高清在线播放| 亚洲欧美日韩成人高清在线一区| 欧美精品一区二| 久久精子c满五个校花| 亚洲国产精品二十页| 欧美高清在线一区| 成人免费在线视频| 亚洲婷婷综合色高清在线| 一区二区理论电影在线观看| 午夜电影网亚洲视频| 激情综合色播五月| 麻豆精品在线视频| 久久成人av少妇免费| 国产成人精品三级| 欧美日韩不卡一区| 精品国产自在久精品国产| 国产亚洲视频系列| 中文字幕一区二区不卡| 性久久久久久久久| 91在线视频免费观看| 制服丝袜国产精品| 中文av字幕一区| 日韩不卡手机在线v区| 高清不卡一二三区| 在线不卡中文字幕播放| 国产精品乱人伦中文| 日本亚洲欧美天堂免费| 大桥未久av一区二区三区中文| 欧美一区二区三区影视| 一区二区激情视频| 成人免费的视频| 久久综合99re88久久爱| 亚洲国产精品久久不卡毛片| 成人精品视频一区二区三区尤物| 欧美精品乱人伦久久久久久| 曰韩精品一区二区| av高清不卡在线| 2014亚洲片线观看视频免费| 日韩av电影免费观看高清完整版在线观看| 成人一区二区三区| 久久久国产综合精品女国产盗摄| 国产一区视频在线看| 欧美一级精品在线| 日韩**一区毛片| 欧美日韩一本到| 青青草国产成人av片免费| 欧美一区二区三区免费视频| 亚洲第一狼人社区| 日韩午夜激情电影| 捆绑变态av一区二区三区| 欧美电影免费观看高清完整版在| 日韩精品一卡二卡三卡四卡无卡| 欧美精品vⅰdeose4hd| 精品一区二区三区久久| 精品久久久影院| 91影院在线观看| 一区二区在线观看av| 日韩欧美一级精品久久| 国产麻豆成人传媒免费观看| 自拍偷拍亚洲欧美日韩| 欧美一区二区在线不卡| 国产精品一二三四区| 一区二区不卡在线播放 | 一区二区三区 在线观看视频| 欧美日韩你懂得| 99re热这里只有精品视频| 夜夜夜精品看看| 久久久.com| 欧美人牲a欧美精品| 粉嫩av一区二区三区在线播放| 一区二区三区久久| 国产亚洲精品福利| 日韩一卡二卡三卡国产欧美| eeuss影院一区二区三区| 国产在线播精品第三| 中文字幕一区二区三区乱码在线 | 国产成人精品亚洲777人妖| 亚洲美女屁股眼交| 国产精品久久三| 国产免费成人在线视频| 欧美va亚洲va香蕉在线| 这里只有精品99re| 色欧美乱欧美15图片| 一本大道av一区二区在线播放| 久草在线在线精品观看| 天天综合网天天综合色| 亚洲一区二区三区爽爽爽爽爽 | 欧美日韩一区在线观看| av一二三不卡影片| 99re热视频精品| 国产精品2024| 91日韩精品一区| 欧美精品123区| 欧美一级电影网站| 国产欧美日韩在线| 国产精品久久久久久久久免费相片 | 国产成人免费xxxxxxxx| 国产激情视频一区二区三区欧美| 久久97超碰国产精品超碰| 国产剧情在线观看一区二区| 国产成人精品影院| 欧美欧美欧美欧美| 日韩一区二区免费在线观看| 中文字幕精品—区二区四季| 中文字幕日本不卡| 亚洲国产精品久久人人爱| 久久精品国产99国产| 国产大陆亚洲精品国产| 欧美中文字幕一区二区三区| 欧美日韩一区二区三区不卡| 久久精品网站免费观看| 亚洲女性喷水在线观看一区| 日本aⅴ亚洲精品中文乱码| 国产精品一区三区| 911精品国产一区二区在线| 国产欧美日韩麻豆91| 日韩精品电影在线观看| 色综合久久久网|