Write a gui program that uses the methods in the Graphics class to draw a smiley face when the window is activated, and a frowny face when the window is deactivated. This will require use of a WindowListener to detect the activation or deactivation events. Must import java.awt.event among others
Here is a link for a very close solution to the problem that did not import java.awt.event and implement its interface and methods. this can be very useful for reference though. All work must be original though and the program must be documented ! http://www.dreamincode.net/forums/topic/170946-windowlistener/ Guidelines for documentation: I. The problem must be completely solved. All paths through the program must produce correct results. A solution that minimally solves the problem gets a minimal grade. However, an enhancement that does not work and/or a program with lovely enhancements that does not solve the original problem properly results is a penalty. II. The documentation must be complete. The beginning of each subportion (class definition) must contain: 1) a statement of purpose, 2) name of the author, 3) dictionary of variables (including type), 4) Arguments and parameters must be made clear to the reader in the dictionary of variables. In addition, documentation should include: a) a description of any dependent subunits, b) date of creation, revision number (if any), and c) and citation of sources ( books, other programs, or other PEOPLE). Intra-code commenting is expected. However, documentation of every line is totally unnecessary. Lines of code/comments should be short and easy to read. Also, variable names must be rational. III. User-friendly Interface is expected. a) Must be a general solution therefore it will be interactive. Values should not be hard coded- (that solves only1 problem) b) Use prompts must be clear and help user to enter data and execute the program correctly. c) The use of correct grammar and spelling in user prompts is assumed. (Penalties are harsh for this error)!!! d) Output should be clearly labeled to facilitate reading and understanding the output. IV. The documentation must tell reader which of the class definitions is to be executed first (which contains main) so that the program executes correctly.