daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Mar 24th, 2012 35 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.Color;
  2. import java.awt.Dimension;
  3. import java.awt.Graphics;
  4.  
  5. import javax.swing.JFrame;
  6. import javax.swing.JPanel;
  7.  
  8. public class randCircle extends JPanel {
  9.         private JFrame f;
  10.         private JPanel p;
  11.  
  12.         public randCircle() {
  13.                 f = new JFrame("Bullseye");
  14.                 p = new JPanel();
  15.  
  16.                 f.setBackground(Color.cyan);
  17.                 p.setPreferredSize(new Dimension(400, 400));
  18.         }
  19.  
  20.         public void paint(Graphics g) {
  21.                 super.paint(g);
  22.                 g.setColor(Color.gray);
  23.                 g.fillOval(0, 0, 20, 20);
  24.         }
  25.  
  26.         public void display() {
  27.                 f.add(p);
  28.                 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29.                 f.setVisible(true);
  30.                 f.pack();
  31.         }
  32. }
  33.  
  34. // Main Class
  35.  
  36. public class randCircleMain {
  37.         public static void main(String args[]) {
  38.                 randCircle panel = new randCircle();
  39.                 panel.display();
  40.         }
  41. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top