My program is supposed to render graphics from the attached file. I can get my program to read the file without issue. My problem lies in getting the file to convert into graphics. I'm not even sure where to begin on this one. To say I'm frustrated would be a major understatement at this point. Here is my code so far:
Any help would be most appreciated. I have been all over google and my textbook trying to figure this out to no avail. The answer is probably staring me right in the face, but I'm at my wits end on this.
Code:
import java.awt.*;
import java.util.*;
import java.io.*;
public class Project8 {
static Graphics g;
// Program to render the objects described in the model file
public static void main(String[] args) throws FileNotFoundException {
Scanner input= new Scanner(new File("sun.txt"));
DrawingPanel panel = new DrawingPanel(500, 500);
g = panel.getGraphics();
while (input.hasNextLine()) {
String text = input.nextLine();
renderCommand(text);
}
}
// takes a String rendering command and renders the specified
// line, oval, or rectangle to the drawing panel
public static void renderCommand(String text) {
Scanner commandLine = new Scanner(text);
String command = commandLine.nextLine();
if (command.equals(text)) {
System.out.println(text);
}
//
}
}