1

ピンポンのようなゲームを作成するクラス用のこのラボがあり、.javaこのラボのファイルを次のリンクのペーストビンに適宜配置しました。

Ball.java: http://pastebin.com/VMg75i8U

Block.java: http://pastebin.com/T7GCTh4z

BallTestTwo.java: http://pastebin.com/gZgR8d2J

Tester.java: http://pastebin.com/fG5f5zZR

Locatable.java: http://pastebin.com/GE77PLJk

私の問題はTester.java、ボールラインをコメントアウトして実行し、目的の結果を得ることができるように、ブロックが正常に機能していることです。ただし、ボール行のコメントを外して実行すると、エラーが発生し、空白の白いキャンバスが表示されます。

最終結果がどうあるべきかを明確にする必要がある場合は、ラボの説明の単語ドキュメントへのリンクを次に示します。https://docs.google.com/file/d/0B_ifaCiEZgtcTVFPX0t2Mzhzczg/edit?usp=sharing https://docs.google.com/file/d/0B_ifaCiEZgtcMFVWYXIxdjZsdDQ/edit?usp=sharing

EDIT 私が受け取っているエラーは、プログラムを強制終了するまで永遠に繰り返されます:

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at BallTestTwo.paint(BallTestTwo.java:42)
    at BallTestTwo.update(BallTestTwo.java:37)
    at sun.awt.RepaintArea.updateComponent(Unknown Source)
    at sun.awt.RepaintArea.paint(Unknown Source)
    at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
4

0 に答える 0