Vectors of objects
From: Luke (lukeita_at_gawab.com)
Date: 11/28/04
- Next message: VisionSet: "Re: Vectors of objects"
- Previous message: Luke: "Re: MenuBar in AWT Java Applets"
- Next in thread: VisionSet: "Re: Vectors of objects"
- Reply: VisionSet: "Re: Vectors of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 28 Nov 2004 12:56:06 GMT
Hello!
A question about a vector of objects...
As I understood the vector contains only objects' memory address
right?
I usually use Vector() to manage my vectors and it contains "genericl"
objects so when I need to use one of the objects I have to cast to the
correct object type...
But how to call an object's method? Have I to use a temp object like:
Vector vect;
BufferedImage temp;
int rgb;
vect = net Vector();
// add some image objects to vect
temp = (BufferedImage)vect.get(1);
rbg = temp.getRGB();
It works but is there a faster way? Something like:
rbg = vect.get(1).getRGB();
which doesn't work as get returns a generic object?
Thanks!
- Next message: VisionSet: "Re: Vectors of objects"
- Previous message: Luke: "Re: MenuBar in AWT Java Applets"
- Next in thread: VisionSet: "Re: Vectors of objects"
- Reply: VisionSet: "Re: Vectors of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]