形成不好的人物(期待报价,得到我)〜处理

时间:2013-01-21 20:17:54

标签: java processing

我希望有人可以帮我解决我的问题。我正在尝试制作一个简单的可视化,以显示足球队在2012年的FIFA排名中如何向上或向下移动。为此,我创建并将17张图像加载到我的草图中,我想根据按钮事件移动。以下是我的代码:

//Setting up the images that will go into the sketch

PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
PImage img12;
PImage img13;
PImage img14;
PImage img15;
PImage img16;
PImage img17;

//loading the images from the file
void setup() {
  size(600, 1100)
  img1 = loadImage('Click.png');
  img2 = loadImage('Team_xxxxx.png');
  img3 = loadImage('Team_xxxxxx.png');
  img4 = loadImage('Team_xxxxxx.png');
  img5 = loadImage('Team_xxxxxxx.png');
  img6 = loadImage('Team_xxxxx.png');
  img7 = loadImage('Team_xxxxxx.png');
  img8 = loadImage('Team_xxxxxxx.png');
  img9 = loadImage('Team_xxxxxx.png');
  img10 = loadImage('Team_xxxxxx.png');
  img11 = loadImage('Team_xxxxx.png');
  img12 = loadImage('Team_xxxxx.png');
  img13 = loadImage('Team_xxxxx.png');
  img14 = loadImage('Team_xxxxxx.png');
  img15 = loadImage('Team_xxxxx.png');
  img16 = loadImage('Team_xxxxx.png');
  img17 = loadImage('Team_xxxxxx.png');
}

//Drawing the images into the sketch
void draw() {
  image(img1, 400, 100);
  image(img2, 100, 250);
  image(img3, 100, 300);
  image(img4, 100, 350);
  image(img5, 100, 400);
  image(img6, 100, 450);
  image(img7, 100, 500);
  image(img8, 100, 550);
  image(img9, 100, 600);
  image(img10, 100, 650);
  image(img11, 100, 700);
  image(img12, 100, 750);
  image(img13, 100, 800);
  image(img14, 100, 850);
  image(img15, 100, 900);
  image(img16, 100, 950);
  image(img17, 100, 1000);
}

我不断收到此错误消息:形成错误的字符(期待引用,得到我)。以下是控制台中的输出:

 processing.app.SketchException: Badly formed character constant (expecting quote, got l)
        at processing.mode.java.preproc.PdePreprocessor.checkForUnterminatedMultilineComment(PdePreprocessor.java:478)
        at processing.mode.java.preproc.PdePreprocessor.write(PdePreprocessor.java:515)
        at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:270)
        at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:185)
        at processing.mode.java.JavaBuild.build(JavaBuild.java:144)
        at processing.mode.java.JavaBuild.build(JavaBuild.java:123)
        at processing.mode.java.JavaMode.handleRun(JavaMode.java:114)
        at processing.mode.java.JavaEditor$19.run(JavaEditor.java:474)
        at java.lang.Thread.run(Thread.java:680)

我在OS X上运行的Macbook Pro上使用Processing 2.0B7。

1 个答案:

答案 0 :(得分:2)

错误可能来自

img1 = loadImage('Click.png');

具体是'Cl位。字符常量由单引号('),某个字符和另一个单引号(')组成。
您拥有的是单引号('),C,然后是l

由于您似乎想要一个字符串常量,请尝试使用双引号:

img1 = loadImage("Click.png");