import javax.swing.*; 

public class Testing extends JFrame {
  public Testing() {
    this.setSize(400, 400);
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    Testing a = new Testing();  
    a.add(new Screen()); 
  }
}

--

import javax.swing.*; 
import java.util.*; 
import java.awt.*;
import java.awt.event.*;

public class Screen extends JComponent implements MouseMotionListener, MouseListener {
  ArrayList<Circle> circles = new ArrayList<Circle>(); 
  Circle current; // = null;
  public Screen() {
    for (int i = 0; i < 3; i++)
      this.circles.add(new Circle(new Point((int)(Math.random()*390) + 5, 
                                            (int)(Math.random()*390) + 5),
                                  (int)(Math.random() * 40 + 10),
                                  Color.WHITE));
    this.addMouseMotionListener(this);
    this.addMouseListener(this);
  }
  public void paintComponent(Graphics g) {
    for (Circle c : this.circles)
      c.draw(g); 
  }
  public void mouseMoved(MouseEvent e) { }
  public void mouseDragged(MouseEvent e) { 
    if (this.current != null) {
      this.current.move(e.getX(), e.getY()); 
      this.repaint(); 
    }
  }

  public void mouseEntered(MouseEvent e) { }
  public void mouseExited(MouseEvent e) { }
  public void mousePressed(MouseEvent e) { 
    for (Circle c : this.circles) {
      if (c.contains(new Point(e.getX(), e.getY()))) {
         this.current = c;
         // break;
      }
    }
    if (this.current != null) {
      this.circles.remove( this.current ); 
      this.circles.add( this.current ); 
    }
  }
  public void mouseReleased(MouseEvent e) { }
  public void mouseClicked(MouseEvent e) { }
}

--

import java.awt.*; 

public class Circle {
  Point center;
  int radius;
  Color color; 
  public Circle(Point center, int radius, Color color) {
    this.center = center;
    this.radius = radius;
    this.color = new Color((float) (Math.random()/2 + 0.5), 
                           (float) (Math.random()/2 + 0.5), 
                           (float) (Math.random()/2) + 0.5f); 
  }
  public void draw(Graphics g) {
    g.setColor(this.color); 
    g.fillOval(center.x - radius, center.y - radius, 2 * radius, 2 * radius); 
    g.setColor(Color.BLACK); 
    g.drawOval(center.x - radius, center.y - radius, 2 * radius, 2 * radius); 
  }
  public boolean contains(Point point) {
    return this.center.distanceTo(point) < this.radius; 
  }
  public void move(int x, int y) {
    this.center = new Point(x, y);  
  }
}

--

public class Point {
  int x, y; 
  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }
  public double distanceTo(Point other) {
    int dx = this.x - other.x;
    int dy = this.y - other.y; 
    return Math.sqrt( dx * dx + dy * dy ); 
  }
}

--