1 2 /* 3 4 The author of this software is Ian Kaplan 5 Bear Products International 6 www.bearcave.com 7 iank@bearcave.com 8 9 Copyright (c) Ian Kaplan, 1999, 2000 10 11 See copyright file for usage and licensing 12 13 */ 14 15 package util; 16 17 /* 18 * errorMessage 19 * 20 21 Support printing error messages in the form: 22 23 <program-name>: <message> 24 25 The class is initialized with the program name at application 26 startup. Since the program name is static, all instance of the 27 class will share the program name. Note that there are two class 28 constructors, one which is passed the program name String and one 29 with no arguments. The argumentless constructor should be used 30 after the class is initialized. 31 32 */ 33 public final class errorMessage { 34 private static String programName = null; 35 36 // 37 // setProgName 38 // 39 public static void setProgName( String name ) { 40 programName = name; 41 } // setProgName 42 43 public static void errorPrint( String msg ) { 44 String name; 45 46 if (programName == null) 47 name = ""; 48 else 49 name = programName; 50 51 System.out.println( name + ": " + msg ); 52 } 53 54 } // errorMessage 55