Class GraphicsCompiler
java.lang.Object
GraphicsCompiler
public class GraphicsCompiler
- extends Object
Class that reads in a file of graphics instructions, and
then generates a NEW Java Program that
does the same thing as the instructions. Default picture size is 640x480.
Format of the file is a bunch of lines of the form:
Command X Y
Commands are "line" with parameters of end X,Y and
"circle" with a parameter of diameter.
For example:
line 10 10 50 70
circle 10 20 30
Which draws a line from (10,10) to (50,70) and a circle at (10,20)
with a diameter of 30.
- Author:
- Barb Ericson, Mark Guzdial
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphicsCompiler
public GraphicsCompiler()
writePrologue
public void writePrologue(BufferedWriter file)
- Method to write out the prolog for the new program:
All the imports, the class definition, main, etc.
- Parameters:
file
- BufferedWriter to write the prologue to
writeEpilogue
public void writeEpilogue(BufferedWriter file)
- Method to write out the epilog for the new program:
Show the picture. Close the main and the class.
- Parameters:
file
- BufferedWriter to write the prologue to
compileCommands
public void compileCommands(String fileName)
- Method to compile the commands in the given file
main
public static void main(String[] args)