// Read a file containing rectangle paint commands // and draw them in a Drawing Panel // See RectanglePainter.java for final solution // Step 1: Get file name from user import java.util.*; import java.io.*; public class Paint1 { public static void main(String[] args) throws FileNotFoundException { String fileName = getFileName(); Scanner fileScan = new Scanner(new File(fileName)); int width = fileScan.nextInt(); int height = fileScan.nextInt(); System.out.println("width: " + width + ", " + height); } public static String getFileName() { Scanner console = new Scanner(System.in); System.out.print("File name: "); return console.next(); } }