我有個問題。 我想添加一個秒錶顯示到我的應用程序。我用這個page作爲參考。 我下載並添加了必要的commons-scxml-0.9.jar庫(帶源代碼)。 有在Eclipse中沒有錯誤,但是當我調試它,在這個class構造超一流(AbstractStateMachine)被稱爲用這個命令:秒錶構造函數需要URL scxmlDocument
超(StopWatch.class.getClassLoader()的getResource(「組織/阿帕奇/公地/ SCXML/ENV/stopwatch.xml「));
但超類構造函數沒有得到任何屬性。它預計最終URL scxmlDocument但只有null出現。
我知道stopwatch.xml看起來如何,但我應該在哪裏放置它,以及如何從它創建最終網址scxmlDocument?
我嘗試了一切,但沒有任何工作。
謝謝大家!
這是stopwatch.xml,如果我將其添加日食因爲ID屬性報告錯誤:
`<?xml version="1.0" ?>
<transition event="watch.start" target="running" />
</state>
<state id="running">
<transition event="watch.split" target="paused" />
<transition event="watch.stop" target="stopped" />
</state>
<state id="paused">
<transition event="watch.unsplit" target="running" />
<transition event="watch.stop" target="stopped" />
</state>
<state id="stopped">
<transition event="watch.reset" target="reset" />
</state>
`
是否有一個理由,爲什麼你正在經歷的這一切痛苦的,而不是隻使用'Chronometer'? – CommonsWare
我先付款,但我會嘗試使用天文臺。感謝您的建議。 – m4gnum