Try

...
cg[count] = (Point3d)myShape.getUserData();
System.out.println(cg[count]);//returning null
count += 1;
...

You were still not accessing the same element.

Andreas

Ashish Aggarwal wrote:
>
> Hello!
>
> That's not the problem. Andreas, try to run the
> program and then see the result. I ran the program by
> changing it but still getUserData returns null.
>
> Please can anybody help me.
>
> Thanks
>
> --- Andreas Kemkes <[EMAIL PROTECTED]> wrote:
> > By using count++ twice, you access a different
> > element than you
> > stored your value in.
> >
> > Andreas
> >
> > Ashish Aggarwal wrote:
> > >
> > > hello!
> > >
> > > Can somebody help me:
> > >
> > > I have a box and cylinder in the screen. I want to
> > > draw a line between them by clicking with mouse. I
> > > have stored the centre of bounds of  two objects
> > > using  setUserData() method. I am also able to
> > pick
> > > the objects on the screen using pick methods.
> > >
> > > The only problem that is coming is that
> > getUserData is
> > > returning null, which I don't know why. I might be
> > > making some silly mistake but i don't have any
> > idea
> > > about it.  I am working on this code for last four
> > > days and have tried different things. I am
> > attaching
> > > the entire code as well as getUserData part.
> > >
> > > Since cg[] is null, i am getting null pointer
> > > exception.
> > >
> > > if ( myShape!=null)
> > > {
> > > cg[count++] = (Point3d)myShape.getUserData();
> > > System.out.println(cg[count]);//returning null
> > > LineArray la=new
> > > LineArray(count,LineArray.COORDINATES);
> > > la.setCoordinates(0,cg);
> > > }
> > >
> > > Please tell me.
> > >
> > > Thanks
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Get personalized email addresses from Yahoo! Mail
> > > http://personal.mail.yahoo.com/
> > >
> > >
> >
> ------------------------------------------------------------------------
> > >                          Name: SimpleLine.java
> > >    SimpleLine.java       Type: JavaScript Program
> > (application/x-javascript)
> > >                      Encoding: base64
> > >                   Description: SimpleLine.java
> >
> >
> ===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED]
> > and include in the body
> > of the message "signoff JAVA3D-INTEREST".  For
> > general help, send email to
> > [EMAIL PROTECTED] and include in the body of the
> > message "help".
>
> =====
> Graduate Research Assistant
> Virtual/Augmented and Rapid Prototyping Lab
> University of Missouri-Rolla
> Rolla, MO 65401
> 573-341-6815 (O)/573-308-1380 (R)
> FAX: 573-341-6815
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to