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

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

?? javatextpane.java

?? 一個很好實用的工作流OSWORKFLOW開發例子.有著非常優秀的靈活性.
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package com.opensymphony.workflow.designer.swing;import java.awt.*;import java.io.IOException;import java.io.Reader;import java.util.*;import javax.swing.*;import javax.swing.text.*;import com.Ostermiller.Syntax.Lexer.JavaLexer;import com.Ostermiller.Syntax.Lexer.Lexer;import com.Ostermiller.Syntax.Lexer.Token;/** * User: Hani Suleiman * Date: Jan 6, 2004 * Time: 4:19:18 PM */public class JavaTextPane extends JTextPane{	/**	  * A hash table containing the text styles.	  * Simple attribute sets are hashed by name (String)	  */	 private static StyleContext styleContext = new StyleContext();	 static	 {		 initStyles();	 }	/**	 * the styled document that is the model for	 * the textPane	 */	protected HighLightedDocument document;	/**	 * A reader wrapped around the document	 * so that the document can be fed into	 * the lexer.	 */	protected DocumentReader documentReader;	/**	 * The lexer that tells us what colors different	 * words should be.	 */	protected Lexer syntaxLexer;	/** A thread that handles the actual coloring. */	protected Colorer colorer;	/**	 * A lock for modifying the document, or for	 * actions that depend on the document not being	 * modified.	 */	private Object doclock = new Object();	public JavaTextPane()	{		super();		document = new HighLightedDocument(styleContext);		setDocument(document);		setCaretPosition(0);		setMargin(new Insets(5, 5, 5, 5));		colorer = new Colorer();		colorer.start();		// create the new document.		documentReader = new DocumentReader(this.document);		syntaxLexer = new JavaLexer(documentReader);	}	/**	 * Run the Syntax Highlighting as a separate thread.	 * Things that need to be colored are messaged to the	 * thread and put in a list.	 */	private class Colorer extends Thread	{		/**		 * Keep a list of places in the file that it is safe to restart the		 * highlighting.  This happens whenever the lexer reports that it has		 * returned to its initial state.  Since this list needs to be sorted		 * and we need to be able to retrieve ranges from it, it is stored in a		 * balanced tree.		 */		private TreeSet iniPositions = new TreeSet(new DocPositionComparator());		/**		 * As we go through and remove invalid positions we will also be finding		 * new valid positions.		 * Since the position list cannot be deleted from and written to at the same		 * time, we will keep a list of the new positions and simply add it to the		 * list of positions once all the old positions have been removed.		 */		private HashSet newPositions = new HashSet();		/**		 * A simple wrapper representing something that needs to be colored.		 * Placed into an object so that it can be stored in a Vector.		 */		private class RecolorEvent		{			public int position;			public int adjustment;			public RecolorEvent(int position, int adjustment)			{				this.position = position;				this.adjustment = adjustment;			}		}		/** Vector that stores the communication between the two threads. */		private volatile Vector v = new Vector();		/**		 * The amount of change that has occurred before the place in the		 * document that we are currently highlighting (lastPosition).		 */		private volatile int change = 0;		/** The last position colored */		private volatile int lastPosition = -1;		private volatile boolean asleep = false;		/**		 * When accessing the vector, we need to create a critical section.		 * we will synchronize on this object to ensure that we don't get		 * unsafe thread behavior.		 */		private Object lock = new Object();		/**		 * Tell the Syntax Highlighting thread to take another look at this		 * section of the document.  It will process this as a FIFO.		 * This method should be done inside a doclock.		 */		public void color(int position, int adjustment)		{			// figure out if this adjustment effects the current run.			// if it does, then adjust the place in the document			// that gets highlighted.			if(position < lastPosition)			{				if(lastPosition < position - adjustment)				{					change -= lastPosition - position;				}				else				{					change += adjustment;				}			}			synchronized(lock)			{				v.add(new RecolorEvent(position, adjustment));				if(asleep)				{					this.interrupt();				}			}		}		/**		 * The colorer runs forever and may sleep for long		 * periods of time.  It should be interrupted every		 * time there is something for it to do.		 */		public void run()		{			int position = -1;			int adjustment = 0;			// if we just finish, we can't go to sleep until we			// ensure there is nothing else for us to do.			// use try again to keep track of this.			boolean tryAgain = false;			for(; ;)			{  // forever				synchronized(lock)				{					if(v.size() > 0)					{						RecolorEvent re = (RecolorEvent)(v.elementAt(0));						v.removeElementAt(0);						position = re.position;						adjustment = re.adjustment;					}					else					{						tryAgain = false;						position = -1;						adjustment = 0;					}				}				if(position != -1)				{					SortedSet workingSet;					Iterator workingIt;					DocPosition startRequest = new DocPosition(position);					DocPosition endRequest = new DocPosition(position + ((adjustment >= 0) ? adjustment : -adjustment));					DocPosition dp;					DocPosition dpStart = null;					DocPosition dpEnd = null;					// find the starting position.  We must start at least one					// token before the current position					try					{						// all the good positions before						workingSet = iniPositions.headSet(startRequest);						// the last of the stuff before						dpStart = ((DocPosition)workingSet.last());					}					catch(NoSuchElementException x)					{						// if there were no good positions before the requested start,						// we can always start at the very beginning.						dpStart = new DocPosition(0);					}					// if stuff was removed, take any removed positions off the list.					if(adjustment < 0)					{						workingSet = iniPositions.subSet(startRequest, endRequest);						workingIt = workingSet.iterator();						while(workingIt.hasNext())						{							workingIt.next();							workingIt.remove();						}					}					// adjust the positions of everything after the insertion/removal.					workingSet = iniPositions.tailSet(startRequest);					workingIt = workingSet.iterator();					while(workingIt.hasNext())					{						((DocPosition)workingIt.next()).adjustPosition(adjustment);					}					// now go through and highlight as much as needed					workingSet = iniPositions.tailSet(dpStart);					workingIt = workingSet.iterator();					dp = null;					if(workingIt.hasNext())					{						dp = (DocPosition)workingIt.next();					}					try					{						Token t;						boolean done = false;						dpEnd = dpStart;						synchronized(doclock)						{							// we are playing some games with the lexer for efficiency.							// we could just create a new lexer each time here, but instead,							// we will just reset it so that it thinks it is starting at the							// beginning of the document but reporting a funny start position.							// Reseting the lexer causes the close() method on the reader							// to be called but because the close() method has no effect on the							// DocumentReader, we can do this.							syntaxLexer.reset(documentReader, 0, dpStart.getPosition(), 0);							// After the lexer has been set up, scroll the reader so that it							// is in the correct spot as well.							documentReader.seek(dpStart.getPosition());							// we will highlight tokens until we reach a good stopping place.							// the first obvious stopping place is the end of the document.							// the lexer will return null at the end of the document and wee							// need to stop there.							t = syntaxLexer.getNextToken();						}						newPositions.add(dpStart);						while(!done && t != null)						{							// this is the actual command that colors the stuff.							// Color stuff with the description of the style matched							// to the hash table that has been set up ahead of time.							synchronized(doclock)							{								if(t.getCharEnd() <= document.getLength())								{									Style style = getStyle(t.getDescription());									document.setCharacterAttributes(t.getCharBegin() + change, t.getCharEnd() - t.getCharBegin(), style, true);									// record the position of the last bit of text that we colored									dpEnd = new DocPosition(t.getCharEnd());								}								lastPosition = (t.getCharEnd() + change);							}							// The other more complicated reason for doing no more highlighting							// is that all the colors are the same from here on out anyway.							// We can detect this by seeing if the place that the lexer returned							// to the initial state last time we highlighted is the same as the							// place that returned to the initial state this time.							// As long as that place is after the last changed text, everything							// from there on is fine already.							if(t.getState() == Token.INITIAL_STATE)							{								//System.out.println(t);								// look at all the positions from last time that are less than or								// equal to the current position								while(dp != null && dp.getPosition() <= t.getCharEnd())								{									if(dp.getPosition() == t.getCharEnd() && dp.getPosition() >= endRequest.getPosition())									{										// we have found a state that is the same										done = true;										dp = null;									}									else if(workingIt.hasNext())									{										// didn't find it, try again.										dp = (DocPosition)workingIt.next();									}									else									{										// didn't find it, and there is no more info from last										// time.  This means that we will just continue										// until the end of the document.										dp = null;									}								}								// so that we can do this check next time, record all the								// initial states from this time.								newPositions.add(dpEnd);							}							synchronized(doclock)							{								t = syntaxLexer.getNextToken();							}						}						// remove all the old initial positions from the place where						// we started doing the highlighting right up through the last						// bit of text we touched.						workingIt = iniPositions.subSet(dpStart, dpEnd).iterator();						while(workingIt.hasNext())						{							workingIt.next();							workingIt.remove();						}						// Remove all the positions that are after the end of the file.:						workingIt = iniPositions.tailSet(new DocPosition(document.getLength())).iterator();						while(workingIt.hasNext())						{							workingIt.next();							workingIt.remove();						}						// and put the new initial positions that we have found on the list.						iniPositions.addAll(newPositions);						newPositions.clear();						/*workingIt = iniPositions.iterator();						while (workingIt.hasNext()){						    System.out.println(workingIt.next());						}						System.out.println("Started: " + dpStart.getPosition() + " Ended: " + dpEnd.getPosition());*/					}					catch(IOException x)					{					}					synchronized(doclock)					{						lastPosition = -1;						change = 0;					}					// since we did something, we should check that there is					// nothing else to do before going back to sleep.					tryAgain = true;				}				asleep = true;				if(!tryAgain)				{					try					{						sleep(0xffffff);					}					catch(InterruptedException x)					{					}				}				asleep = false;			}		}	}	/**	 * Color or recolor the entire document	 */	public void colorAll()	{		color(0, document.getLength());	}	/**	 * Color a section of the document.	 * The actual coloring will start somewhere before	 * the requested position and continue as long	 * as needed.	 *	 * @param position   the starting point for the coloring.	 * @param adjustment amount of text inserted or removed	 *                   at the starting point.	 */	public void color(int position, int adjustment)	{		colorer.color(position, adjustment);	}	/**	 * Just like a DefaultStyledDocument but intercepts inserts and	 * removes to color them.	 */	private class HighLightedDocument extends DefaultStyledDocument	{		public HighLightedDocument(StyleContext styles)		{			super(styles);		}		public void insertString(int offs, String str, AttributeSet a) throws BadLocationException		{			synchronized(doclock)			{				super.insertString(offs, str, a);				color(offs, str.length());				documentReader.update(offs, str.length());			}		}		public void remove(int offs, int len) throws BadLocationException		{			synchronized(doclock)			{				super.remove(offs, len);				color(offs, -len);				documentReader.update(offs, -len);			}		}	}	/**	 * A wrapper for a position in a document appropriate for storing	 * in a collection.	 */	class DocPosition	{		/** The actual position */		private int position;		/**		 * Get the position represented by this DocPosition		 *		 * @return the position		 */		int getPosition()		{			return position;		}		/**		 * Construct a DocPosition from the given offset into the document.		 *		 * @param position The position this DocObject will represent		 */		public DocPosition(int position)		{			this.position = position;		}		/**		 * Adjust this position.		 * This is useful in cases that an amount of text is inserted		 * or removed before this position.		 *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产99久久久国产精品| 国产精品乡下勾搭老头1| 经典三级在线一区| 色综合久久中文综合久久97| 日韩欧美不卡一区| 亚洲美女偷拍久久| 国产成人av自拍| 91精品中文字幕一区二区三区| 国产精品国产三级国产有无不卡 | 欧美一级精品大片| 国产精品热久久久久夜色精品三区 | 精品国产乱码久久久久久图片| 亚洲已满18点击进入久久| www.视频一区| 国产精品天美传媒| 国产高清精品网站| 精品国产乱码久久久久久免费| 亚洲va韩国va欧美va| 在线亚洲欧美专区二区| 中文字幕不卡在线| 福利电影一区二区| 日本一区二区视频在线观看| 裸体一区二区三区| 日韩欧美国产三级电影视频| 青娱乐精品在线视频| 欧美精品第1页| 日本三级亚洲精品| 91久久线看在观草草青青| 日韩伦理免费电影| 99久久精品国产一区二区三区| 欧美高清一级片在线观看| 国产美女在线观看一区| 久久老女人爱爱| 成人激情午夜影院| 亚洲日本电影在线| 在线观看av一区二区| 亚洲成人动漫一区| 日韩一级片网站| 国产在线不卡视频| 中文字幕一区二区视频| 在线看日韩精品电影| 亚洲午夜成aⅴ人片| 欧美一区二区三区四区高清| 日韩和欧美的一区| 久久免费午夜影院| 白白色 亚洲乱淫| 亚洲综合丁香婷婷六月香| 欧美亚洲动漫精品| 久久99久久久欧美国产| 久久中文字幕电影| 成人a级免费电影| 亚洲一卡二卡三卡四卡五卡| 欧美精品一级二级| 精油按摩中文字幕久久| 国产精品免费免费| 欧美系列日韩一区| 麻豆精品久久久| 久久午夜免费电影| 色噜噜偷拍精品综合在线| 日韩精品乱码av一区二区| 久久先锋影音av鲁色资源网| 91女厕偷拍女厕偷拍高清| 麻豆精品视频在线观看视频| 国产精品美女久久久久高潮| 欧美人成免费网站| 国产成人高清在线| 亚洲成人激情综合网| 国产欧美一区二区三区沐欲| 色婷婷综合久久久久中文 | 色综合久久六月婷婷中文字幕| 亚洲大片免费看| 国产精品免费aⅴ片在线观看| 精品视频在线免费观看| 国产91色综合久久免费分享| 亚洲香肠在线观看| 国产无人区一区二区三区| 欧美日韩免费一区二区三区| 成人国产精品免费网站| 日韩国产精品91| 一区二区三区四区在线播放 | 911精品国产一区二区在线| 国产黄色精品视频| 日韩和的一区二区| 亚洲免费电影在线| 国产午夜精品久久久久久久 | 韩国理伦片一区二区三区在线播放| 亚洲精品国产第一综合99久久 | 久久午夜羞羞影院免费观看| 欧美精品久久天天躁| 99re免费视频精品全部| 国产黑丝在线一区二区三区| 免费在线成人网| 图片区小说区区亚洲影院| 亚洲欧美乱综合| 国产精品理论片| 国产欧美中文在线| 久久日一线二线三线suv| 日韩三级在线免费观看| 欧美浪妇xxxx高跟鞋交| 欧美综合亚洲图片综合区| 99综合电影在线视频| 国产99久久精品| 国产成人aaa| 国产成人免费av在线| 国产精品亚洲а∨天堂免在线| 精品一区二区在线免费观看| 青青草国产精品97视觉盛宴| 日产精品久久久久久久性色| 亚州成人在线电影| 日韩中文字幕不卡| 日本不卡中文字幕| 麻豆精品在线视频| 国产一区二区视频在线| 精品一区二区在线免费观看| 极品瑜伽女神91| 国产成人免费在线| 不卡视频一二三四| 91国产成人在线| 在线播放视频一区| 欧美一级高清大全免费观看| 欧美成人一区二区三区 | 欧美一级在线观看| 777久久久精品| 精品国产精品一区二区夜夜嗨| 久久亚洲私人国产精品va媚药| 久久精品水蜜桃av综合天堂| 国产欧美日韩在线视频| 中文字幕中文字幕一区| 一区二区三区资源| 日韩高清在线电影| 国产又黄又大久久| 色哟哟国产精品免费观看| 精品视频资源站| 久久综合色8888| 国产精品三级在线观看| 亚洲一区av在线| 黑人精品欧美一区二区蜜桃 | 中文字幕一区av| 亚洲第一av色| 国产精品一区二区在线播放| 不卡视频在线观看| 欧美一卡二卡在线| 国产精品国产三级国产aⅴ中文| 亚洲尤物在线视频观看| 蜜桃视频免费观看一区| 成人a级免费电影| 91精品中文字幕一区二区三区| 久久久久久久久伊人| 尤物在线观看一区| 精品一区二区在线观看| 欧洲国内综合视频| 久久在线免费观看| 亚洲成av人片在www色猫咪| 国产精品一二一区| 欧美日韩一区成人| 欧美激情一区二区| 美日韩一区二区| 在线免费观看一区| 久久精品一级爱片| 日韩**一区毛片| 日本伦理一区二区| 国产精品网站在线| 久久se这里有精品| 欧美性做爰猛烈叫床潮| 国产精品污网站| 激情综合色综合久久综合| 欧美视频自拍偷拍| 中文字幕一区二区三区精华液| 九九精品视频在线看| 91精品久久久久久久99蜜桃| 久久先锋影音av鲁色资源| 亚洲123区在线观看| 一本到不卡免费一区二区| 国产三区在线成人av| 久久精品72免费观看| 欧美日韩精品系列| 亚洲精品欧美综合四区| 成人av在线资源| 久久综合久久鬼色中文字| 日韩精彩视频在线观看| 欧美三区免费完整视频在线观看| 国产精品伦一区二区三级视频| 精品一区二区精品| 日韩网站在线看片你懂的| 午夜久久久久久久久久一区二区| 91在线视频免费观看| 日韩欧美国产精品一区| 亚洲日本电影在线| 99天天综合性| 国产精品剧情在线亚洲| 国产 日韩 欧美大片| 久久久久久免费毛片精品| 久久国产精品色| 日韩欧美一二三区| 另类调教123区| 26uuu亚洲婷婷狠狠天堂| 极品少妇一区二区| 精品国产百合女同互慰| 国内精品伊人久久久久av影院 | 99麻豆久久久国产精品免费|