<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    神奇好望角 The Magical Cape of Good Hope

    庸人不必自擾,智者何需千慮?
    posts - 26, comments - 50, trackbacks - 0, articles - 11
      BlogJava :: 首頁 ::  :: 聯系 :: 聚合  :: 管理

    JDK 源代碼中的搞笑之處

    Posted on 2007-11-30 17:47 蜀山兆孨龘 閱讀(1108) 評論(0)  編輯  收藏
    JDK 源代碼中的搞笑之處 Funny Things in JDK Source
      雖然完整版的 JDK 源代碼現已開放了,但安裝在 Java\jdk[版本號] 目錄下的公共 src.zip 仍然是我最經常參考的資源。每次我遇到一個 API 問題,都會刊這個公共源代碼。解決問題之余,我還找到很多有趣的東西,有時還搞笑。這里距三個例子。     Though the full version of JDK source is available now, but the public src.zip installed under Java\jdk[version_number] directory is still my most frequent refered resource. Every time I encounter an API problem, this public source is read. And besides solving those problems, I've also found many interesting things which are sometimes also funny. Here are three exaples.
      大概從 JDK 5.0 開始,類 java.lang.Object 引入了一個叫 wait(long timeout, int nanos) 的方法。等等,nanos,納秒?眾所周知,即使在強大的 Windows 多媒體 API 里面,計時器的精度也只有一毫秒,也就是一兆納秒。盡管 Java 非常棒,但不能處理納秒。而源代碼證明了這一點,納秒被舍入到最接近的毫秒,0 或 1……精彩……     Maybe since JDK 5.0, a method called wait(long timeout, int nanos)is introduced into Class java.lang.Object.Object. Wait a minute, nanos, is it nanoseconds? It's no secret thst even in powerful Windows multimedia API, the precision of timer is only one millisecond, that is a million nanosecond. Though Java is pretty great, it can not deal with nanoseconds. And the source proves it, that nanoseconds are rounded to the nearest millisecond, 0 or 1... Amazing...
      今天我想得到一個 JDialog 的所有者,但卻沒有 getOwner() 方法。最后我才明白 JDialog 的所有者就是它的父組件,用 getParent() 就可以了。那現在所有者等同于父級了?     Today I wanted to get a JDialog's owner, but there's no method called getOwner(). Finally I was awear that the owner of a JDialog is exactly its parent component, and just using getParent() is okey. So owner is synonymous with parent now?
      最后,我想提下 JSpinner 的實現有錯。一些安裝在 JSpinner 上的偵聽器絲毫不起作用。我在 JSpinner.java 里找到這段注釋:“還是不對,我們沒其他辦法了,SpinnerModelJFormattedTextField 現已不同步了。”JDK 的開發者的誠實值得感謝。我的解決方法是直接操控復合式組件 JSpinner 中的 JFormattedTextField     At last, I wanna mention the JSpinner implementation is bugged. Some kinds of listener installed on a JSpinner take no effect at all. I found this comment in JSpinner.java: "Still bogus, nothing else we can do, the SpinnerModel and JFormattedTextField are now out of sync." The JDK developers deserve a thank for honesty. My solution is to directly manipulate the JFormattedTextField within JSpinner, a compound JComponent.

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 久久亚洲精品成人AV| 国产午夜亚洲精品午夜鲁丝片| 亚洲欧洲日产国码无码网站 | 免费精品国产日韩热久久| 亚洲av无码一区二区三区乱子伦| 国产大片免费天天看| 久久亚洲2019中文字幕| 国产精品玖玖美女张开腿让男人桶爽免费看| 亚洲AV中文无码乱人伦在线视色| 羞羞视频免费网站入口| 国产精品亚洲精品日韩已方| 久久久受www免费人成| 亚洲va在线va天堂va四虎| 777爽死你无码免费看一二区| 亚洲酒色1314狠狠做| 国产卡一卡二卡三免费入口| 亚洲av午夜国产精品无码中文字 | 四虎影院在线免费播放| 美女被免费网站在线视频免费| xvideos亚洲永久网址| 国产区在线免费观看| 亚洲国产高清人在线| 在线看片v免费观看视频777| 亚洲欧美国产国产综合一区| 亚洲不卡无码av中文字幕| 曰批全过程免费视频在线观看无码| 亚洲卡一卡2卡三卡4卡无卡三| 成年人免费的视频| 色噜噜的亚洲男人的天堂| 亚洲精品国产字幕久久不卡| 亚洲免费精彩视频在线观看| 久久亚洲精品国产精品婷婷| 亚洲精品第一国产综合境外资源 | 亚洲爆乳无码专区www| 三上悠亚亚洲一区高清| 亚洲精品视频在线免费| 黄色网页免费观看| 亚洲视频免费观看| 亚洲AV之男人的天堂| 国产精品免费观看| 一级成人a免费视频|