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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.