Hello
If you allow I want to help in this program
Required of him is when the user presses the mouse is draw a circle
After the completion of the drawing of circles
The user also using the mouse draw the lines between these circles
Similar to what is in this video to clarify


YouTube - applet kruskal blog (applet en internet).wmv


When I worked the program featured the first problem is that he does not paint when you press on the mouse
This is the code that you typed
XML Code:
     
import java.util.ArrayList;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.ArrayList;


public class TestPanelDrawing2 extends JPanel implements MouseListener,MouseMotionListener {

static int x;static int y;
 static  ArrayList<Ellipse2D.Double> vert = new ArrayList<Ellipse2D.Double>();
        
        public void mouseDragged(MouseEvent e) {
        	
        	
        	}
       
        public void mouseMoved (MouseEvent e) {}
        	 
      
        
        public void mouseClicked(MouseEvent e){
        x=e.getX();
        y=e.getY();
        
       add(new drowcycle());
        }
        
    public void mouseEntered(MouseEvent e) {}           
    public void mousePressed(MouseEvent e){}     
    public void	mouseReleased(MouseEvent e) {}
    public void	mouseExited(MouseEvent e) {}
    	 

     public TestPanelDrawing2() {
   
     addMouseListener(this);
     addMouseMotionListener(this);
       
   }
   
     

        public static void main(String[] args) {
        TestPanelDrawing2 p = new TestPanelDrawing2();
        JFrame frame=new JFrame();
        frame.add(p);
        frame.setTitle("TestPanelDrawing");
        frame.setLocationRelativeTo(null); // Center the frame
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(600, 400);
        frame.setVisible(true);
        }
}

class drowcycle extends JPanel {

        public void paint(Graphics g) {
        Font r = new Font("SansSerif", Font.BOLD, 16);
        g.setFont(r);
        draw(g);
        }

        public void draw(Graphics g) {
        
                Graphics2D g2 = (Graphics2D) g;
                super.paint(g);
                int x1=TestPanelDrawing2.x;
              	int y1=TestPanelDrawing2.y;
              	
                Ellipse2D.Double a = new Ellipse2D.Double(x1 + 5, y1, 15, 15);
                TestPanelDrawing2.vert.add(a);
                g.drawString(" A", x1 + 5, y1);
                
                g2.fill(new Ellipse2D.Double(x1, y1, 15, 15));
                
                
        }
        }


class drowline extends JPanel {

        public void paint(Graphics g) {
        Font r = new Font("SansSerif", Font.BOLD, 16);
        g.setFont(r);
        draw(g);
        }

        public void draw(Graphics g) {
        
                Graphics2D g2 = (Graphics2D) g;
                super.paint(g);
                int x1=TestPanelDrawing2.x;
              	int y1=TestPanelDrawing2.y;
              	
              
                g.drawString(" A", x1 + 5, y1);

                g2.fill(new Ellipse2D.Double(x1, y1, 15, 15));
                
                
        }
        }