亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲成av人影院在线观看网| 日韩在线卡一卡二| 蜜臀99久久精品久久久久久软件| 国产精品中文欧美| 欧美日韩精品二区第二页| 国产日本欧洲亚洲| 蜜乳av一区二区| 91久色porny | 国产成人综合网站| 欧美在线观看视频一区二区| 国产午夜精品一区二区 | 一区二区三区色| 国产成人午夜高潮毛片| 欧美一区二区精品在线| 亚洲电影一区二区| 色综合中文字幕国产| 中文一区二区完整视频在线观看| 极品少妇一区二区| 日韩欧美国产综合| 蜜桃精品视频在线| 欧美一激情一区二区三区| 亚洲午夜免费电影| 欧美亚男人的天堂| 亚洲国产精品一区二区尤物区| 91网站黄www| 成人免费在线播放视频| 成人污污视频在线观看| 国产三级精品视频| 国产69精品久久99不卡| 久久久精品中文字幕麻豆发布| 久久精品国产澳门| 精品欧美乱码久久久久久 | 国产中文字幕一区| 2023国产一二三区日本精品2022| 亚洲福利视频三区| 在线播放/欧美激情| 免费在线观看视频一区| 精品日产卡一卡二卡麻豆| 激情综合网最新| 久久免费看少妇高潮| 国产美女主播视频一区| 中文av一区二区| 91网站最新网址| 亚洲18影院在线观看| 91精品免费观看| 久久99久久久久| 国产日本欧洲亚洲| 色综合久久综合| 日韩精品1区2区3区| 精品久久一二三区| 不卡视频一二三四| 亚洲一区二区三区四区在线 | 蜜臀99久久精品久久久久久软件| 欧美一区二区三区四区视频| 久久99国产精品尤物| 国产精品久久一卡二卡| 在线观看av一区| 久久精品国产第一区二区三区| 国产亚洲欧洲一区高清在线观看| 成年人网站91| 天堂影院一区二区| 国产欧美中文在线| 欧美性色aⅴ视频一区日韩精品| 视频一区视频二区中文| 久久久久99精品一区| 在线看一区二区| 精品一区在线看| 亚洲久草在线视频| 26uuu色噜噜精品一区| 91浏览器入口在线观看| 日本一不卡视频| 国产精品看片你懂得| 91精品国产aⅴ一区二区| 成人免费黄色大片| 蜜臀99久久精品久久久久久软件| 国产三级三级三级精品8ⅰ区| 91啪在线观看| 国产精品系列在线观看| 日韩精品亚洲一区| 亚洲久草在线视频| 国产欧美久久久精品影院| 欧美在线观看禁18| 成人久久久精品乱码一区二区三区| 亚洲成年人网站在线观看| 中文字幕一区在线观看视频| 欧美电视剧在线观看完整版| 91福利精品视频| av在线一区二区| 国产盗摄精品一区二区三区在线| 性久久久久久久| 亚洲美女电影在线| 国产欧美日本一区二区三区| 欧美一区二区性放荡片| 在线精品观看国产| 99精品久久只有精品| 国产成人一级电影| 国产一区二区中文字幕| 免费成人在线观看视频| 亚洲风情在线资源站| 亚洲精品视频自拍| 亚洲三级在线看| 国产精品国产自产拍高清av| 精品噜噜噜噜久久久久久久久试看| 在线看日韩精品电影| 99免费精品在线| 成人av电影在线播放| 成人免费毛片a| 成人听书哪个软件好| 国产成人三级在线观看| 国产露脸91国语对白| 国内精品伊人久久久久av一坑| 日韩精品1区2区3区| 青青草精品视频| 麻豆国产欧美一区二区三区| 久久激情五月婷婷| 韩国理伦片一区二区三区在线播放| 蜜臀av性久久久久av蜜臀妖精| 蜜桃av噜噜一区二区三区小说| 久久精品二区亚洲w码| 精品中文字幕一区二区小辣椒| 日韩激情视频网站| 久久疯狂做爰流白浆xx| 紧缚奴在线一区二区三区| 国产综合色在线视频区| 国产黄色成人av| 99精品黄色片免费大全| 91视频国产资源| 欧美日韩国产经典色站一区二区三区 | 精品久久一区二区三区| www日韩大片| 欧美国产一区二区在线观看| 日本一区二区不卡视频| 亚洲免费视频中文字幕| 亚洲国产视频a| 激情图区综合网| 成人免费看的视频| 欧美影视一区二区三区| 国产日韩精品一区| 亚洲美女区一区| 日韩av不卡在线观看| 国产伦精一区二区三区| 97精品超碰一区二区三区| 欧美三日本三级三级在线播放| 日韩欧美国产麻豆| 中文字幕中文在线不卡住| 午夜私人影院久久久久| 国内精品在线播放| 日本精品一级二级| 精品播放一区二区| 亚洲免费视频成人| 久久69国产一区二区蜜臀| voyeur盗摄精品| 欧美一区二区视频网站| 国产精品视频看| 日韩电影在线免费看| 国产成人福利片| 欧美精品久久久久久久久老牛影院| 精品国产sm最大网站| 亚洲一区视频在线| 国产一区二区免费视频| 欧美性受xxxx黑人xyx| 国产午夜一区二区三区| 亚洲国产精品久久艾草纯爱| 国产精品影音先锋| 正在播放一区二区| 亚洲视频一二三区| 国产成人免费在线| 日韩欧美一区二区不卡| 亚洲女爱视频在线| 国产精品自拍毛片| 91精品国产乱码| 亚洲精品欧美在线| 成人动漫视频在线| 久久影院视频免费| 日韩二区三区四区| 欧美午夜精品理论片a级按摩| 日本一区二区免费在线观看视频 | 亚洲人成精品久久久久| 国内精品在线播放| 91麻豆精品91久久久久同性| 一区二区三区国产精华| 暴力调教一区二区三区| 久久综合狠狠综合久久激情| 青青草原综合久久大伊人精品| 欧美图区在线视频| 伊人婷婷欧美激情| 99久久er热在这里只有精品66| 国产欧美一区二区精品秋霞影院 | 久久99国产精品免费| 欧美美女一区二区三区| 一区二区久久久久| 日本高清不卡视频| 尤物视频一区二区| 91国内精品野花午夜精品| 成人免费在线视频观看| 9久草视频在线视频精品| 中文字幕中文字幕在线一区 | 亚洲人123区| 色综合久久久久久久久| 国产精品国产三级国产普通话99 |