锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品99久久久香蕉,亚洲xxx大片,久久理论电影http://www.aygfsteel.com/mmmyddd/category/26834.html<font color="olive">瀵掑瀛ょ伅鐐圭偣鏄?lt;/color>zh-cnThu, 15 May 2008 06:57:32 GMTThu, 15 May 2008 06:57:32 GMT60Java GUI 涓殑綰跨▼瀹夊叏闂http://www.aygfsteel.com/mmmyddd/archive/2008/05/14/200475.html鎳墊嚨鐏伅鎳墊嚨鐏伅Wed, 14 May 2008 12:42:00 GMThttp://www.aygfsteel.com/mmmyddd/archive/2008/05/14/200475.htmlhttp://www.aygfsteel.com/mmmyddd/comments/200475.htmlhttp://www.aygfsteel.com/mmmyddd/archive/2008/05/14/200475.html#Feedback0http://www.aygfsteel.com/mmmyddd/comments/commentRss/200475.htmlhttp://www.aygfsteel.com/mmmyddd/services/trackbacks/200475.html
From錛歨ttp://www.jguru.com/faq/view.jsp?EID=131370


Question - Please explain why Swing is not thread safe and AWT is.

Answer
Simple answer is - "that's the design choice the Swing team made". It is a well-known fact that writing thread safe API/library is more difficult and inefficient.

So to simplify the implementation of Swing library they chose it to be not thread safe. The argument being that most of the GUI related work happens in the callbacks from the GUI which happen on the single GUI thread anyways. Granted - for long running tasks the user will have to do more work if he/she wants to do multithreaded activity. Not making Swing thread safe allowed them to implement the Swing which covered a lot more ground (new controls, layouts, keyboard actions, layered pane etc) in a short amount of time.

It is not that bad though - Swing does provide a mechanism to deal with the issues of threading -

  • javax.swing.SwingUtilities.invokeLater(Runnable ...);
  • javax.swing.SwingUtilities.invokeAndWait(Runnable ...);
  • javax.swing.JProgressBar class
  • javax.swing.ProgressMonitor
  • javax.swing.ProgressMonitorInputStream
  • SwingWorker

For more explaination of why they made that decision please see the following URLs:

The AWT is based on the OS's WIndowing System's peer objects which are inherently thread safe. That is why AWT is thread safe.

One can argue though that they should have provided factory methods (similar to collections framework) or subclasses to get thread safe versions of the Swing classes - for example, TSJTextField or TSJTree where the "TS" stands for 'thread safe'


鍙﹀ , swt鍜宻wing涓鏍烽兘鏄嚎紼嬩笉瀹夊叏鐨勶紝 浣嗘槸java.util.Timer紜槸瀹夊叏鐨勶紝

thread safe闂褰掓牴緇撳簳鏄綾誨拰鏂規(guī)硶鏄惁鍙噸鍏ワ紝re-entrance.



鎳墊嚨鐏伅 2008-05-14 20:42 鍙戣〃璇勮
]]>
Java, Welcome back!http://www.aygfsteel.com/mmmyddd/archive/2008/01/01/171932.html鎳墊嚨鐏伅鎳墊嚨鐏伅Mon, 31 Dec 2007 17:45:00 GMThttp://www.aygfsteel.com/mmmyddd/archive/2008/01/01/171932.htmlhttp://www.aygfsteel.com/mmmyddd/comments/171932.htmlhttp://www.aygfsteel.com/mmmyddd/archive/2008/01/01/171932.html#Feedback0http://www.aygfsteel.com/mmmyddd/comments/commentRss/171932.htmlhttp://www.aygfsteel.com/mmmyddd/services/trackbacks/171932.html浣滀簡榪戝崐騫寸殑Linux/C鐩稿叧鐨勯」鐩紝緇堜簬杞埌Java浜嗭紝Welcome Back!



鎳墊嚨鐏伅 2008-01-01 01:45 鍙戣〃璇勮
]]>
[JAVA]java.util.ResourceBundle浣跨敤http://www.aygfsteel.com/mmmyddd/archive/2007/12/11/166926.html鎳墊嚨鐏伅鎳墊嚨鐏伅Tue, 11 Dec 2007 05:53:00 GMThttp://www.aygfsteel.com/mmmyddd/archive/2007/12/11/166926.htmlhttp://www.aygfsteel.com/mmmyddd/comments/166926.htmlhttp://www.aygfsteel.com/mmmyddd/archive/2007/12/11/166926.html#Feedback0http://www.aygfsteel.com/mmmyddd/comments/commentRss/166926.htmlhttp://www.aygfsteel.com/mmmyddd/services/trackbacks/166926.html闃呰鍏ㄦ枃

鎳墊嚨鐏伅 2007-12-11 13:53 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 九江市| 辰溪县| 安图县| 西和县| 克拉玛依市| 资中县| 耒阳市| 盐池县| 卢氏县| 云林县| 都昌县| 夏津县| 沙河市| 京山县| 民勤县| 佛坪县| 积石山| 翼城县| 静乐县| 丰宁| 无极县| 孟连| 墨江| 那曲县| 田东县| 青岛市| 大足县| 德州市| 谷城县| 平遥县| 武鸣县| 德清县| 英吉沙县| 密山市| 仙居县| 滦平县| 淅川县| 赤水市| 内丘县| 长岭县| 瓮安县|