亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产福利电影一区二区三区| 欧美xxxx在线观看| 精品卡一卡二卡三卡四在线| 亚洲欧美怡红院| 精品制服美女丁香| 欧美揉bbbbb揉bbbbb| 国产精品久久久久久久久免费樱桃| 首页亚洲欧美制服丝腿| 91亚洲精华国产精华精华液| www国产成人| 日韩av电影天堂| 91高清视频免费看| 国产精品久久久久三级| 国产精品99久久久久| 日韩三级伦理片妻子的秘密按摩| 亚洲视频在线观看三级| 成人午夜激情片| 欧美精品一区二区高清在线观看| 亚洲国产裸拍裸体视频在线观看乱了| 北岛玲一区二区三区四区| 日韩免费观看高清完整版| 午夜精品久久久久久久久久久| 91丨porny丨中文| 中文一区一区三区高中清不卡| 极品少妇xxxx精品少妇| 欧美一区午夜视频在线观看| 亚洲一区二区成人在线观看| 色哟哟国产精品| 一区二区三区免费网站| 91麻豆免费看| 亚洲最新在线观看| 欧美做爰猛烈大尺度电影无法无天| 国产精品天干天干在线综合| 成人精品gif动图一区| 中文字幕av在线一区二区三区| 国产精品99久久久久| 国产精品日韩精品欧美在线| 豆国产96在线|亚洲| 国产精品成人免费在线| www.色综合.com| 亚洲欧美日韩综合aⅴ视频| caoporen国产精品视频| 亚洲三级免费电影| 欧美日韩日日摸| 美女视频黄久久| 久久久91精品国产一区二区精品| 国产成人一区在线| 国产精品黄色在线观看| 欧美在线制服丝袜| 蜜臀久久99精品久久久久久9 | 美国欧美日韩国产在线播放| 3751色影院一区二区三区| 另类欧美日韩国产在线| 久久中文娱乐网| 97se亚洲国产综合自在线观| 亚洲一区视频在线观看视频| 制服丝袜在线91| 韩国av一区二区三区四区| 国产精品网友自拍| 欧美日韩日本视频| 国产一区二区久久| 一区二区三区**美女毛片| 欧美精品在线观看一区二区| 国内成人免费视频| 亚洲精品ww久久久久久p站| 日韩免费电影一区| 91亚洲国产成人精品一区二三| 日本美女一区二区三区| 国产精品人成在线观看免费| 欧美视频一区二区三区在线观看| 九色|91porny| 一级特黄大欧美久久久| 久久午夜国产精品| 欧美视频在线一区| 国产伦精品一区二区三区视频青涩| 中文字幕一区不卡| 精品国精品自拍自在线| 91蜜桃免费观看视频| 经典一区二区三区| 亚洲成人免费电影| 国产精品第13页| 日韩精品影音先锋| 欧美视频自拍偷拍| 国产福利一区二区三区视频在线| 亚洲一区二区三区视频在线 | 911精品国产一区二区在线| 国产精品一二二区| 天天综合色天天综合色h| 国产日韩欧美麻豆| 欧美成人r级一区二区三区| 日韩一级大片在线| 色狠狠综合天天综合综合| 国产精品一二三| 九九视频精品免费| 日本亚洲三级在线| 亚洲成人av中文| 亚洲男同性视频| 自拍偷拍国产精品| 欧美国产精品一区| 国产午夜亚洲精品午夜鲁丝片| 欧美日韩精品一区二区三区四区| av在线不卡电影| 欧美图片一区二区三区| 91免费版在线| 国内外成人在线视频| 奇米精品一区二区三区在线观看 | 久久日韩精品一区二区五区| 欧美精品丝袜久久久中文字幕| 99re热视频精品| av在线一区二区| av电影在线观看不卡| 99这里只有精品| av电影在线观看完整版一区二区| 精品亚洲成a人| 激情都市一区二区| 激情综合五月天| 国产精品一二三四| 成人精品在线视频观看| 99精品偷自拍| 色88888久久久久久影院按摩| 成人综合在线视频| av一区二区三区在线| 一本久久a久久免费精品不卡| 色综合久久综合网| 欧美日韩国产小视频| 日韩美女在线视频| 国产日韩欧美综合一区| 国产精品久久久久久久久动漫 | 91香蕉视频mp4| 色哟哟国产精品| 欧美精品v国产精品v日韩精品| 欧美三级电影网站| 日韩无一区二区| 日本一区免费视频| 亚洲永久精品大片| 琪琪一区二区三区| 国产成人综合精品三级| 91网站在线播放| 欧美日韩亚洲综合一区二区三区| 欧美一区在线视频| 中文av一区二区| 亚洲h在线观看| 国产一区二区导航在线播放| 91丨九色porny丨蝌蚪| 欧美一级在线免费| 国产精品二三区| 奇米精品一区二区三区在线观看一| 狠狠色狠狠色综合日日91app| www.激情成人| 欧美精品一级二级| 中文字幕一区二| 麻豆91精品视频| 一本一本久久a久久精品综合麻豆| 制服丝袜激情欧洲亚洲| 国产精品全国免费观看高清| 亚洲mv大片欧洲mv大片精品| 国产成人在线色| 91精品综合久久久久久| 国产精品成人午夜| 精品一区二区综合| 欧美综合在线视频| 中文字幕第一区综合| 蜜桃久久av一区| 欧美偷拍一区二区| 中文字幕av一区二区三区 | 亚洲一区二区欧美| 国产99久久久精品| 日韩小视频在线观看专区| 亚洲欧美日韩精品久久久久| 国内精品国产成人| 欧美日韩国产中文| 1024亚洲合集| 高清在线观看日韩| 日韩精品影音先锋| 无吗不卡中文字幕| 在线亚洲一区二区| 国产精品国产三级国产普通话蜜臀 | 91捆绑美女网站| 日本一区二区成人| 久久99最新地址| 91精品国产手机| 亚洲一区二区欧美日韩| 一本色道综合亚洲| 成人欧美一区二区三区黑人麻豆| 国产一区二区免费在线| 日韩一级片网址| 亚洲成人av一区| 欧美综合在线视频| 一区二区三区日韩欧美精品| a级高清视频欧美日韩| 中文字幕欧美激情一区| 国产精品资源在线看| 2欧美一区二区三区在线观看视频| 秋霞午夜鲁丝一区二区老狼| 欧美色综合久久| 亚洲高清视频的网址| 欧美亚洲丝袜传媒另类| 亚洲黄色av一区| 欧美系列亚洲系列| 亚洲一区视频在线|