Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image in List Class

 
anirudh bargotra
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add the image in the List class beside the text.
is it possible..
if yes pls. help.....
 
Rahul Rathore
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can add add any Object in a list or any collection. It may be a String or it may be an Image. Both are instances of java.lang.Object.
 
anirudh bargotra
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But it is not working...
List lst;
Image img;
public void init()
{
img=getImage(getDocumentBase(), "test.gif");
lst =new List();
lst.add(img);
}
this is not working giving compilation error....
because List calss oesnot support Image as constructer parameter.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anirudh,
Oh, okay... you are talking about the List AWT Component! Well, no, it does not let you add Images to it... the List that comes with AWT does not come with that functionality... you would have to write your own list component to do this, or use JList in Swing.
HTH,
-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic