Java game error not read Neighborhoods

Java games aircraft error can not read for help

at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.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.NoClassDefFoundError: Could not initialize class Explode
at MyGameFrame.paint(MyGameFrame.java:41)
at MyGameFrame.update(MyGameFrame.java:130)
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.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.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.NoClassDefFoundError: Could not initialize class Explode
at MyGameFrame.paint(MyGameFrame.java:41)
at MyGameFrame.update(MyGameFrame.java:130)
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.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain3.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomain 4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain4.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.security.ProtectionDomainJavaSecurityAccessImpl.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)

import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Date;

public class MyGameFrame extends Frame {

/**
*
*/
private static final long serialVersionUID = 905833189003569926L;
Image planeImg = GameUtil.getImage("images/plane.png");
Image bg = GameUtil.getImage("images/bg.jpg");

Plane plane = new Plane(planeImg,300,150);
Shell[] shells = new Shell[60];

BaO Explode;
a Date startTime = new new a Date ();
a Date endTime;
int period; game duration //

public void paint (Graphics g) { // called automatically. g corresponds to a brush
G.drawImage (BG, 0, 0, null);

plane.drawSelf (g);
// draw all shells
for (int I = 0; I <shells.length; I ++) {
shells [i] .draw (g);
collision detection // aircraft and artillery
Boolean Peng shells = [I] .getRect () the intersects (plane.getRect ());.
IF (Peng) {
plane.live = to false;
IF (BaO == null) {
BaO = new new Explode (plane.x, plane.y);
}
bao.draw (G);
}

// timer
IF (! plane.live) {
IF (endTime == null) {
endTime a Date new new = ();
}
period = (int) ((endTime.getTime () - startTime.getTime ()) / 1000);
printInfo (G, "time:" + period + "seconds", 40,120,240, Color.BLUE) ;
}
}
}
public void printInfo (Graphics g,String str, int size, int x,int y,Color color) {
g.setColor(color);
g.getFont();
g.drawString(str, x, y);

}

//重画窗口
class PaintThread extends Thread {
public void run() {
while(true){
repaint(); //重画
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

}


// define keyboard listener inner class
class KeyMonitor extends KeyAdapter {

@Override
public void keyPressed(KeyEvent e) {
plane.addDirection(e);
}

@Override
public void keyReleased(KeyEvent e) {
plane.minusDirection(e);
}


}

void launchFrame public () {
this.setTitle ( "First as");
this.setVisible (to true);
this.setSize (Constant.GAME_WIDTH, Constant.GAME_HEIGHT);
this.setLocation (200 is, 300);

this.addWindowListener (new new WindowAdapter An () {
public void the windowClosing (WindowEvent E) {
System.exit (0);
}
});

new new PaintThread () start ();. // start window redraw thread
addKeyListener (new KeyMonitor ()); // listening to the window to increase the keyboard


// initialize shell 60
for (int I = 0; I <shells.length; I ++) {
shells [I] = new new Shell ();
}

}

public static void main(String[] args) {
MyGameFrame f = new MyGameFrame();
f.launchFrame();
}

Image offScreenImage null = Private;

public void Update (Graphics G) {
IF (offScreenImage == null)
offScreenImage = this.createImage (Constant.GAME_WIDTH, Constant.GAME_HEIGHT); // this is the width and height of the game window

Graphics gOff = offScreenImage .getGraphics ();
Paint (Goff);
G.drawImage (offScreenImage, 0, 0, null);
}
--------------------- 

Guess you like

Origin www.cnblogs.com/hyhy904/p/11058035.html
Recommended