Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- public class Maincode extends JPanel {
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- Graphics2D g2d = (Graphics2D) g;
- g2d.setColor(Color.red);
- int xo, yo;
- int p;
- for(p = 3; p < 99999; p++){
- for(int d = 2; d < p-1; p++){
- if(p % d == 0){
- break;
- }
- int x = (int)(p * Math.cos(p) / 100.0) + 500;
- int y = (int)(p * Math.sin(p) / 100.0) + 500;
- g2d.drawLine(x, y, x + 1, y + 1);
- }
- }
- }
- public static void main(String[] args) {
- Maincode points = new Maincode();
- JFrame frame = new JFrame("Points");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.add(points);
- frame.setSize(1000, 800);
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement