Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.geom.*;
- import java.math.*;;
- public class ForWhile extends Frame {
- public void paint(Graphics g) {
- Graphics2D graph = (Graphics2D)g;
- graph.setStroke(new BasicStroke(5.0f));
- graph.setColor(Color.yellow);
- Shape circle = new Ellipse2D.Float(100.0f, 100.0f, 500.0f, 500.0f);
- graph.draw(circle);
- graph.fill(circle);
- //lines
- double t;
- int radius = 250;
- double x = 100 , y=250 , px , py;
- //for(float i = 0 ; i < 60 ; i++) {
- for(int a = 0; a <= 360; a+=20)
- {
- px = (int) (Math.cos(Math.toRadians(a)) * 600) + 350;
- py = (int) (Math.sin(Math.toRadians(a)) * 600) + 350;
- Line2D line1 = new Line2D.Double(px, py, 350, 350);
- graph.draw(line1);
- }
- // px = x * Math.cos(Math.toRadians(j)) + y * Math.sin(Math.toRadians(j));;
- // py = y * Math.cos(Math.toRadians(j)) - x *Math.sin(Math.toRadians(j));
- //}
- }
- public static void main(String[] args) {
- Frame frame = new ForWhile();
- frame.addWindowListener(
- new WindowAdapter(){
- public void windowClosing(WindowEvent we){
- System.exit(0);
- }
- }
- );
- frame.setSize(1000, 1000);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement