File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes A Bit Of A Puzzle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "A Bit Of A Puzzle" Watch "A Bit Of A Puzzle" New topic

A Bit Of A Puzzle

Peyton McCullough
Ranch Hand

Joined: Feb 07, 2004
Posts: 31
I'm puzzled right now as to what to do, maybe some of you Java dieties can help me.
Basically, I have an auction system ( application, not applet ) for a popular game. Players can auction items. Right now, you can pick a category and it displays all the auctions from the category. It does this by sending the server a message. The server then queries the MySQL database and sends back a list of auctions. They are all added to the jList.
What I want to do is improve on the listing of auctions to create icons for each list item signifying different things, such as a locked auction. I can get the info on the server-side, no problem, but actually listing them is what puzzles me.
Now, I could use a ListCellRenderer, but I before I start I want to be sure of exactly how I want to tackle it. I'm a bit confused as to how to make the renderer. In the example I have seen, it adds a row for each item in an array. It looks all fine and dandy, but does that kill the purpose of adding rows manually? Furthermore, would it repaint itself every time I got a new list from the server?
Any replies are appreciated.
// :: Peyton
Peyton McCullough
Ranch Hand

Joined: Feb 07, 2004
Posts: 31
I overcame my stubborness to try it without seeing if my thoughts were correct - and it worked!
For those of you searching through the threads in this forum a year or two from now - ListCellRenderers still work with manual additition of list items.
Heh, I should have tried it before posting, but I didn't want to write anything I didn't have to. Sorry.
subject: A Bit Of A Puzzle
It's not a secret anymore!