Due: Tuesday, April 24th, at 7pm
Important: This is an individual assignment. Please do not collaborate.
Requirements to get full credits in Documentation
You can look at the Java programs in the text book to see how comments are added to programs.
Minimal Submitted Files
You are required, but not limited, to turn in the following source files:
Assignment12.java(The Assignment12 class extends JApplet)
ControlPanel.java (It extends JPanel, to be completed)
FanPanel.java (It extends JPanel)
You may add more classes or more methods than they are specified. (You might need them.)
Skills to be Applied:
Classes may be needed:
Timer in javax.swing package, JApplet, JButton, Container, JPanel, Color, Graphics, JSlider, JLabel, ActionListener, ActionEvent, ChangeListener, ChangeEvent. You may use other classes.
Suggested Class Diagram: (.ppt file is available for this figure)
Write a Java program that constructs an Applet.
The Applet (JApplet) of your program should contain six buttons, "Start Red", "Stop Red", "Reverse Red", "Start Blue", "Stop Blue", and "Reverse Blue". The first three buttons will be organized vertically, and the latter three buttons will also be organized vertically. Next to each set of buttons, there will be a label "Red Fan Delay" (or "Blue Fan Delay"), then below it, there will be a slider that a user can use to change the delay of each fan. Note that if the delay (interval) of a fan decreases, its speed will be faster. Below the buttons and sliders, there are two panels, one panel showing a red fan moving counter-clockwise, and the other panel showing a blue fan moving counter-clockwise. The picture below shows the initial position of each fan. Each fan consists of two filled arcs, and black un-filled circle to show its perimeter.
When "Stop" button is pushed, corresponding fan (of the color) stops. When "Start" button is pushed, the fan start moving to the direction that it was going before it stopped. "Reverse" reverses the direction of a fan, thus if it was moving counter-clockwise, then it should start moving clockwise, and vice versa. If the fan was not moving when "Reverse" button is pushed, then the fan should start moving after changing its direction.
By moving each slider, a user should be able to change the delay interval of each fan. When a delay decreases, the corresponding fan should move faster, and when a delay increases, the fan should move slower. Note that these two fans (red and blue) can have a completely independent movement of each other.
My tutorial contains Java Programs, Applet and HTML
If you have more questions, please contact me via email email@example.com
I will help you any time
Thank you !