java.lang.Error:未解析的编译

时间:2014-05-09 02:00:53

标签: java compilation

我正在开展一个学校项目,我们不得不做一个纸牌游戏。我制作的游戏是一个记忆游戏,它使用数组来存储鼠标位置的索引。无论如何,我试图编译我的程序以查看它将如何运行,但我无法弄清楚如何使程序正常运行。

package Memory_Game;

import processing.core.PApplet;
import processing.core.PApplet;
import processing.core.PFont;
import processing.core.PImage;

import java.util.*;
import java.awt.event.*;
import java.lang.Math.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.swing.JOptionPane;
import static java.lang.System.out;

public class MemoryGame extends PApplet
{
    private static final int cols = 2;
    private static final int rows = 3;
    private static final String Memory_Game = null;
    Card[] cards;

public void setup() 
{
    size(rows * Card.width, cols * Card.height);
    cards = new Card[cols * rows];
    cards[0] = new Card(11, 0, 0);
    cards[1] = new Card(3, Card.width, 0);
    cards[2] = new Card(7, 2 * Card.width, 0);
    cards[3] = new Card(3, 0, Card.height);
    cards[4] = new Card(7, Card.width, Card.height);
    cards[5] = new Card(11, 2 * Card.width, Card.height);
}

public void draw()
{
    background(204);
    for (int i = 0; i < 6; i++) 
    {
        cards[i].display(this);
    }
}

public void mousePressed() 
{
    for (int i = 0; i < 6; i++) 
    {
        cards[i].flip();
        cards[i].display(this);
    }
}

public static void main(String[] args) 
{
    PApplet.main(Card.MemoryGame);
}
}

错误发生在程序的最后一行。线程&#34; main&#34;中的例外情况java.lang.Error:未解决的编译问题:     MemoryGame无法解析或者不是Memory_Game.MemoryGame.main中的字段(MemoryGame.java:60)

有谁知道如何解决这个问题?

public class Card
{
   boolean shown = false;
   static final int width = 120;
   static final int height = 180;
   static final int gap = 20;
   int value;
   float x;
   float y;

   public Card(int _v, float _x, float _y) 
   {
       value = _v;
       x = _x;
       y = _y;
   }

   public void display(PApplet applet) 
   {
       applet.stroke(0);
       applet.strokeWeight(2);
       if (shown) 
       {
           applet.fill(100);
           applet.rect(x, y, width, height);
           applet.textAlign(PConstants.CENTER, applet.CENTER);
           applet.textSize(width / 2);
           applet.fill(0);
           applet.text(value, x + width/2 , y + height / 2);
       } 
       else 
       {
           applet.fill(255);
           applet.rect(x, y, width, height);
       }
   }

   public void flip() 
   {
       shown =! shown;
   }
}

0 个答案:

没有答案