• Welcome to Valhalla Legends Archive.
 

JList help in Java

Started by DOOM, November 11, 2003, 06:22 PM

Previous topic - Next topic

DOOM

Hey everyone.  I need to be able to add an icon along with a string to a JList in Java.  For example, if someone joins using the client Starcraft, I want to add the [STAR] icon and their username to the JList.  Any help would be appreciated, thanks.

iago

I'm not sure that JList can do that.  I'm not really sure how you would do that in Java, but I've thought about it before.  I can ask a prof at school later this week, if nobody else knows.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


DOOM

Well I've heard some stuff about having to add a DefaultListModel to the JList to do it, but I haven't really found any helpful information on how exactly to get it to work right.  I've gotten it to add an icon or add a string.  The problem is that it will add the icon on one line and then the text on the next line, which isn't what I'm looking for.  I don't know, it's been a big pain in the ass for me so far.  Thanks for the help though.  If you could remember to ask your prof I'd appreciate it.

iago

#3
It's not THAT important, though, for now I'd just do something like, "[STAR] iago", assuming you're trying to write a bot.

Edit: ah, good, you did say that's what you wanted.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


DOOM

Okay, thanks.  I may have to do it that way, at lest temporarilly.

Banana fanna fo fanna

Take a look at the LimeWire cvs.