Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4.  
  5. import javax.swing.JFrame;
  6. import javax.swing.JPanel;
  7.  
  8. public class Maincode extends JPanel {
  9.  
  10. public void paintComponent(Graphics g) {
  11. super.paintComponent(g);
  12.  
  13. Graphics2D g2d = (Graphics2D) g;
  14.  
  15. g2d.setColor(Color.red);
  16. int xo, yo;
  17.  
  18. int p;
  19.  
  20. for(p = 3; p < 99999; p++){
  21. for(int d = 2; d < p-1; p++){
  22. if(p % d == 0){
  23. break;
  24. }
  25.  
  26. int x = (int)(p * Math.cos(p) / 100.0) + 500;
  27. int y = (int)(p * Math.sin(p) / 100.0) + 500;
  28. g2d.drawLine(x, y, x + 1, y + 1);
  29. }
  30. }
  31.  
  32.  
  33. }
  34.  
  35.  
  36. public static void main(String[] args) {
  37. Maincode points = new Maincode();
  38. JFrame frame = new JFrame("Points");
  39. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  40. frame.add(points);
  41. frame.setSize(1000, 800);
  42. frame.setLocationRelativeTo(null);
  43. frame.setVisible(true);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement