can you solve this please? Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle. x=r*cos(t) y=r*sin(t) with t in range [0, 2p] and r is the radius of the circle. (the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it ) and here is a sample of what they want me to use : package javaapplication1; import java.awt.
can you solve this please?
Adopt appropriate Java animation code to implement the video in the file “test4.wmv” and given that the parametric equation for a circle.
x=r*cos(t)
y=r*sin(t)
with t in range [0, 2p] and r is the radius of the circle.
(the circle goes in a loop like in the images, i did my best to try to explain it , please try to do it )
and here is a sample of what they want me to use :
package javaapplication1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.geom.*;
import java.util.Random;
import javax.imageio.*;
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.awt.event.*;
import java.util.Calendar;
public class JavaApplication1 extends JApplet {
public static void main(String[] args) {
JFrame frame=new JFrame();
frame.setTitle("hello");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applete =new JavaApplication1();
applete.init();
frame.getContentPane().add(applete);
frame.pack();
frame.setVisible(true);
}
@Override
public void init(){
JPanel panel=new JApp1Panel();
getContentPane().add(panel);
}
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
class JApp1Panel extends JPanel implements Runnable{
Point2D.Double[] pts = new Point2D.Double[1200];
public JApp1Panel() {
setPreferredSize(new Dimension(640, 480));
setBackground(Color.gray);
for (int i = 0; i < pts.length; i++) {
pts[i] = new Point2D.Double(Math.random(), Math.random());
}
Thread thread = new Thread(this);
thread.start();
}
@Override
public void run() {
while(true) {
for (int i = 0; i < pts.length; i++) {
double x = pts[i].getX();
double y = pts[i].getY();
y += 0.1*Math.random();
if (y > 1) {
y = 0.3*Math.random();
x = Math.random();
}
pts[i].setLocation(x, y);}
repaint();
try {
Thread.sleep(100);
} catch (InterruptedException ex) {}
} }
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.white);
for (int i = 0; i < pts.length; i++) {
int x = (int)(640*pts[i].x);
int y = (int)(480*pts[i].y);
int h = (int)(25*Math.random());
g.drawLine(x, y, x, y+h);
}
}
}// end of JApp1Panel class
![ܩ](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F824586c6-c032-4133-b851-24de1ff7e9fb%2F5d260ff5-4225-4b35-b610-b207176f3f7a%2Fp9ytx2_processed.png&w=3840&q=75)
![](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F824586c6-c032-4133-b851-24de1ff7e9fb%2F5d260ff5-4225-4b35-b610-b207176f3f7a%2Fscw5hzs_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)