-
Coloring elements in JList or any other?
Hi
Can we color items in a listbox.For example if there are two array of strings and i am displaying them in a listbox(JList). i need first array of strings in black and second array of strings in red color.Can we do that in java?
We cannot directly do the same thing in VB with ListBox. for that we have to use ListView for coloring elements.
So is there any component in java like vb has? Is it feasible?
Thanks
srinivasa kanchiraju
-
Take a look at the API documentation for JList and you'll see a discussion about a ListCell Renderer interface. Your own implementation of the ListCellRenderer you associate with your JList can allow you to change the background, foreground, text color, etc. of the content of each of the cells in your list. This is another example of the separation of the manipulation of content (through a "Model") and the manipulation of presentation (through "Renderer" type interfaces) that you also find in JTables.
Similar Threads
-
Replies: 3
Last Post: 02-02-2006, 04:50 PM
-
Replies: 2
Last Post: 12-27-2005, 01:39 AM
-
By datechie in forum Java
Replies: 3
Last Post: 06-13-2005, 10:34 AM
-
Replies: 1
Last Post: 12-04-2001, 10:44 AM
-
Replies: 1
Last Post: 07-12-2001, 06:15 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks