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.*;
- import java.lang.*;
- public class ForWhile extends Frame {
- public void paint(Graphics g) {
- Graphics2D graph = (Graphics2D)g;
- graph.setStroke(new BasicStroke(3.0f));
- graph.setColor(Color.black);
- Shape circle = new Ellipse2D.Float(100.0f, 100.0f, 500.0f, 500.0f);
- graph.draw(circle);
- //lines
- double px , py;
- //for(float i = 0 ; i < 60 ; i++) {
- for(double a = 0; a <= 360; a+=5)
- {
- px = (int) (Math.cos(Math.toRadians(a)) * 250) + 350;
- py = (int) (Math.sin(Math.toRadians(a)) * 250) + 350;
- Line2D line1 = new Line2D.Double(px, py, 350, 350);
- graph.draw(line1);
- }
- }
- 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