锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品视频在线观看网站,3d成人动漫在线,91精品影视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浜嗭紝W(xué)elcome 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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 灌南县| 阿克| 洪江市| 方正县| 黎城县| 监利县| 江口县| 乐至县| 德庆县| 大邑县| 毕节市| 西宁市| 湾仔区| 长武县| 巫山县| 封丘县| 清河县| 贡嘎县| 安福县| 调兵山市| 苗栗县| 池州市| 宁河县| 兴业县| 东台市| 益阳市| 台南县| 云林县| 天台县| 枣阳市| 阆中市| 文化| 抚顺市| 岳西县| 宝清县| 盘锦市| 延安市| 沐川县| 芜湖市| 四子王旗| 右玉县|