亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91精品国产高清一区二区三区蜜臀| 中文字幕五月欧美| 欧美高清hd18日本| 色吧成人激情小说| 一本到三区不卡视频| 91亚洲精品久久久蜜桃网站| 成人精品电影在线观看| 福利电影一区二区| 91在线porny国产在线看| 99久久精品情趣| 色综合中文字幕国产| 国产999精品久久| 国产日韩精品视频一区| 久久久久久99精品| 国产精品视频yy9299一区| 欧美精彩视频一区二区三区| 欧美高清在线视频| 中文字幕一区二区三区精华液| 中文幕一区二区三区久久蜜桃| 一区在线中文字幕| 一区二区三区av电影| 亚洲成人在线免费| 久久综合综合久久综合| 国产乱码精品一区二区三区忘忧草| 国产福利91精品| 91欧美一区二区| 欧美亚洲丝袜传媒另类| 日韩欧美在线1卡| 国产欧美日韩视频一区二区| 国产精品成人免费| 亚洲成人免费视频| 美女国产一区二区三区| 高清久久久久久| 欧美视频一区在线观看| 日韩视频免费观看高清完整版| 久久精品在这里| 一区二区三区欧美| 另类小说图片综合网| av一区二区三区四区| 欧美日韩国产三级| 国产日韩精品一区| 亚洲午夜久久久久中文字幕久| 蜜臀久久久久久久| av不卡免费电影| 欧美一级免费观看| 国产精品国产三级国产a| 婷婷丁香激情综合| 国产成人亚洲精品青草天美| 欧洲一区二区三区在线| 精品国产一区二区精华| 中文字幕一区二区三区在线不卡| 午夜精品免费在线| 不卡一区二区中文字幕| 91麻豆精品国产无毒不卡在线观看| 国产日韩欧美精品一区| 亚洲成人一区在线| 成人a免费在线看| 在线播放国产精品二区一二区四区| 久久噜噜亚洲综合| 日精品一区二区三区| 成人美女视频在线看| 欧美一级淫片007| 一区二区三区四区激情| 精品一区二区国语对白| 在线精品视频免费播放| 久久精品在线观看| 奇米777欧美一区二区| 91麻豆精品一区二区三区| 91蝌蚪porny成人天涯| 欧洲精品在线观看| 欧美国产成人精品| 美女网站色91| 欧美日韩免费一区二区三区视频| 精品国产免费人成在线观看| 亚洲制服丝袜一区| hitomi一区二区三区精品| 欧美sm极限捆绑bd| 亚洲一级不卡视频| 99re热这里只有精品视频| 久久亚洲免费视频| 美腿丝袜亚洲综合| 制服丝袜中文字幕一区| 一区二区不卡在线视频 午夜欧美不卡在 | 在线观看免费视频综合| 欧美国产一区视频在线观看| 精品一区二区三区影院在线午夜| 欧美乱熟臀69xxxxxx| 一区二区三区中文字幕精品精品 | 成人免费黄色大片| 久久久久久久久久久久久久久99| 日韩电影在线免费看| 欧美色图片你懂的| 一区二区欧美精品| 色老头久久综合| 亚洲女人****多毛耸耸8| 成人黄色一级视频| 中文字幕一区二区不卡| 成人免费看的视频| 亚洲欧洲av另类| av不卡在线播放| 亚洲精品亚洲人成人网| 色婷婷激情综合| 一区二区三区精密机械公司| 日本精品裸体写真集在线观看| 亚洲摸摸操操av| 在线观看亚洲一区| 午夜精品在线看| 91麻豆精品国产91久久久| 精品国产髙清在线看国产毛片| 日本va欧美va精品发布| 精品国产一区二区亚洲人成毛片| 久久精工是国产品牌吗| 精品久久久久久亚洲综合网| 极品美女销魂一区二区三区免费| 欧美videos中文字幕| 激情六月婷婷综合| 中文欧美字幕免费| 色婷婷av久久久久久久| 亚洲靠逼com| 在线不卡中文字幕播放| 麻豆精品国产传媒mv男同| 色呦呦国产精品| 欧美成人欧美edvon| 国产一区二区三区最好精华液| 欧美成人精品二区三区99精品| 国产在线观看免费一区| 国产三级欧美三级| 99re热这里只有精品视频| 偷拍自拍另类欧美| 欧美一区二区国产| 国产成人av电影在线观看| 中文字幕一区二区三| 欧美日韩激情一区二区三区| 天天操天天色综合| 久久久精品中文字幕麻豆发布| av中文一区二区三区| 亚洲国产精品久久久久婷婷884| 日韩亚洲欧美成人一区| 国产jizzjizz一区二区| 一区二区高清在线| 精品国产伦一区二区三区观看方式| 国产成人av在线影院| 一区二区高清在线| 久久综合狠狠综合久久综合88 | 国产99一区视频免费| 亚洲欧美福利一区二区| 欧美一级淫片007| 成人黄色电影在线| 舔着乳尖日韩一区| 国产成人在线视频免费播放| 亚洲国产精品久久一线不卡| 2020国产成人综合网| 色猫猫国产区一区二在线视频| 蜜桃视频在线一区| 亚洲色图视频网站| 精品国产污网站| 色老汉一区二区三区| 狠狠色丁香婷婷综合久久片| 亚洲欧美另类综合偷拍| 精品福利在线导航| 色综合一个色综合亚洲| 国产一区二区视频在线| 亚洲妇女屁股眼交7| 国产色综合久久| 欧美日本免费一区二区三区| 不卡影院免费观看| 久国产精品韩国三级视频| 亚洲精品大片www| 国产亚洲成年网址在线观看| 欧美日韩精品一区视频| 成人福利视频在线| 久久爱www久久做| 亚洲成人在线网站| 中文字幕一区不卡| 国产午夜久久久久| 欧美变态凌虐bdsm| 欧美人体做爰大胆视频| 99re免费视频精品全部| 国产精品1区2区3区| 蜜臀av一区二区| 视频一区在线视频| 亚洲国产精品一区二区www在线| 国产精品国产精品国产专区不片 | 亚洲综合一区二区三区| 日本一区二区电影| 欧美不卡激情三级在线观看| 欧美日韩一区不卡| 在线免费观看成人短视频| 成人白浆超碰人人人人| 国产白丝精品91爽爽久久| 久久精品国产成人一区二区三区| 亚洲成人一二三| 亚洲韩国一区二区三区| 亚洲免费观看在线观看| 成人欧美一区二区三区| 国产精品色婷婷久久58| 久久九九全国免费| 久久蜜桃一区二区| 欧美精品一区二区三区视频 | 一区二区视频免费在线观看|