Question: Use java as the programming language Write a Swing program with a class called FaceDrawing that extends the JFrame class. This class uses the methods
Use java as the programming language

Write a Swing program with a class called FaceDrawing that extends the JFrame class. This class uses the methods in the Graphics class together with threads to draw a smiley face, wait two seconds, draw a frowny face, wait two seconds, and repeat starting with smiley face. To handle this, you will need to do the following: Your class should have a boolean instance variable called isSmiling. Create a method called drawFaces that creates a new Thread. The Thread should contain an infinite loop that toggles isSmiling to true or false, calls repaint, and then sleeps for two seconds. Override your paint method. It should call the super class's paint and then either draw a smiley face or a frowny face depending on whether isSmiling is true or false. As an additional note: the methods from Graphics that might be of use are drawOval, fillOval, and drawArc. The application should be responsive and exit immediately if the user decides to close the window
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
