Results 1 to 6 of 6

Thread: [RESOLVED]please help with Vector

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    youngstown, oh
    Posts
    202

    Resolved [RESOLVED]please help with Vector

    Hello, I am still wokring on the same project and I have come into yet another problem I'd like to learn to fix now.

    The desgin should be as follows : I need to pass x-y coordiantes to a Vector, so i can store them. Left clicking would draw a circle and get the coordinates of the point clicked. The Vector is there so if I were to right click I could erase the last stored coordinates.

    Here's what I was given to work with...

    Code:
    class ImagePanel extends JPanel {
    
       private BufferedImage currentbufimg;     // this is the real image associated with each ImagePanel object.
       private int           panelID;           // identifier for each ImagePanel.
       private UIDDemo1      parent;            // parent object.
       private Vector        features;          // features to be selected by the users.
    As you can see the Vector is named features.... and a paint component will call the drawfeatures object....and then...

    Code:
    public void paintComponent(Graphics g){
    	super.paintComponent(g);
    	if(currentbufimg != null)
             g.drawImage(currentbufimg,0,0,this);
          if(panelID == 1 || panelID == 2)
    	   drawFeatures(g);
          if(panelID == 3) {
             drawDisplacement(g);
          }
       }
    ...i'm with left this little bit of code to figure out how i would be able to get those variables passed to the Vector.
    Code:
    public void drawFeatures(Graphics g) {
          Graphics2D g2d = (Graphics2D)g;
          g2d.setColor(Color.white);
          
         // draw circles and save to Vector.


    I already have a mouse event handler to capture the x-y coordniates when the mouse is clicked. I just need some type of guidence on how i could go abouts doing this...I understand the add etc of the Vector soem what, but will i need another mouse event to get thsi started.

    Again any guidence will be very helpful, for i am tryin my best to understand and learn thsi Java. Thansk again - Justin
    Last edited by jlbovo; Nov 22nd, 2006 at 10:13 AM.
    --thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width