This site requires JavaScript, please enable it in your browser!
Greenfoot back
aldrisang
aldrisang wrote ...

2017/2/15

mlk -> JoC #30

aldrisang aldrisang

2017/2/15

#
Michael, I've run across another issue that keeps a game from compiling, and this happens with your breakout-v4.zip from Joy of Code #30 (Introduction to Loops). The line number is 23 is in Counter.java. Here is that line and the next one, constructing a font:
img.setFont(img.getFont().deriveFont(Font.BOLD));
img.setFont(img.getFont().deriveFont(16.0F));
It says cannot find symbol BOLD. I'm not sure what the second line is actually doing, so the fix I came up with to make it compile (with a bold font) is to use a constructor from the new Font class included with Greenfoot, like so:
img.setFont(new Font(true, false, 16));  // bold, not italic, size 16
I'm sure there are other ways to do it; I know there are other constructors. If you are compiling a list of disclaimers to update JoC to work with the new Greenfoot "Color" and "Font" classes, I'll happily keep referring these to you. :) It might be easier to e-mail anything I find to you, but I don't have any contact info for that. Mine is aldrisang@gmail.com if you wish to contact me privately. Cheers!
You need to login to post a reply.