Guest User

Untitled

a guest
May 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package objectoriented;
  2.  
  3. import java.awt.*;
  4. import javax.swing.*;
  5.  
  6. /**
  7.  *
  8.  * @author AMRoche
  9.  */
  10. public class PointScrib extends Scribble {
  11.     //JFrame frame = new JFrame("Line Graphing.");
  12.  
  13.     int x ;
  14.     static int wide ;
  15.     static int high ;
  16.  
  17.     public PointScrib(int range, int width, int height) {
  18.         x = range;
  19.         wide = width;
  20.         high = height;
  21.     }
  22.  
  23.     public void paintComponent (Graphics g) {
  24.         g.setColor(Color.BLACK);
  25.         g.fillRect(0, 0, wide, high);
  26.        
  27.         for (int i = 0; i < x; i++) {
  28.             Color lol = new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255),(int) (Math.random() * 255) );
  29.             g.setColor(lol);
  30.             g.fillOval((int) ((wide - 1) * Math.random()), (int) ((high-1) * Math.random()), 2,2);
  31.         }
  32.     }
  33.  
  34.     public static void main(String[] args) {
  35.  
  36.     }
  37. }
Add Comment
Please, Sign In to add comment