// Unit03vST.java // 07-18-10 by Leon Schram // This is the student starting program for the Unit02 lab assignment. // When you execute this program, enter DK1.dat, DK2.dat or blank.dat import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.*; import java.awt.*; import javax.swing.JOptionPane; public class Unit03vST extends Frame implements WindowListener { private int numRows = 36; // 35 Rows are displayed. The top row is hidden behind the title bar. private int numCols = 50; private String background[]; public Unit03vST() { this.addWindowListener(this); String fileName = JOptionPane.showInputDialog("Enter file name for graphics background."); background = new String[numRows]; try { BufferedReader inStream = new BufferedReader(new FileReader("resources/" + fileName)); String line; int row = 0; line = inStream.readLine(); while(line != null) { background[row] = line; row++; line = inStream.readLine(); } } catch (IOException e) { System.out.println("There were problems with the code as stated below\n"); System.out.println(e.getMessage()); } System.out.println(); repaint(); } public void paint(Graphics g) { } public int convert(int q) { return 0; } public void drawSpace (Graphics g, int y, int x) { } public void drawGirder (Graphics g, int y, int x) { } public void drawLadder (Graphics g, int y, int x) { } public void drawHammer(Graphics g, int y, int x) { } public void drawBarrel (Graphics g, int y, int x) { } public static void main(String [] args) { Unit03vST f = new Unit03vST (); f.setSize(1000,800); f.setVisible(true); f.setLayout(new FlowLayout()); } public void windowClosing(WindowEvent e) { dispose(); System.exit(0); } public void windowOpened(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } }