0

hi,

i want to design my list item with background image,font faces and sizes when it selected by using Html tags.

for example,

// Contacts(userName, userIcon)
Contacts contacts[] =
{
new Contacts("<html> <table width= '75%' height='57' border='1'><tr> <td align='center' background='resources/id.gif'><img src='resources/id.gif' width='22' height='20'>Username", resources/id.gif"),

...
};

JList contactsList = new JList(contacts);

i got partially.. i got table data i couldn't set the images in that.. instaed of images, it shows image broken link. but the same image, i can assign for the userIcon.

why i include table here means, i want to display the contacts with all information like Name, image, place when it selected.

and another one, how i implement this to display at Listitem selected.

if anyone know this, pls tell me

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by Phaelax
0

i have absolutely no idea what you're trying to ask.

As to the last question, you need to add an ActionListener

contactList.addActionListener(listListener)

in the class would be 1 method, public void actionPerformed(ActionEvent e)
Easiest way is to implement the interface, make your method, then just add "this" for the listener. To get the selected item:

contactList.getSelectedItem()

It'll return an object, so you'll have to cast it, probably to a String it looks like.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.