This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Thinlet Question  RSS feed

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Iam using Thinlet in my project. Iam using list(A list allows the user to select one or more objects from a list). Iam creating an empty list initially, and adding items to the list dynamically. So i wanted to colour each list item dynamically at runtime. Each list item needs to have a different color depending on certain conditions. So, how to clolor each item in a list dynamically??

Kindly help,

-Sundar
 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sundar-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it; specifically, a first name and a last name are required. Please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

As to your question, AWT itself does not support this (and neither does Swing), so Thinlet can't add that behavior.
 
Bartender
Posts: 9507
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you have to do is write a ListCellRenderer that does the coloring you need. There's information in the JList API Doc and the Java Tutorial Swing trail
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I stand corrected regarding Swing. But Thinlet uses AWT, so it's still not going to work.
 
Sundar Ram
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
Hello Sundar-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it; specifically, a first name and a last name are required. Please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

As to your question, AWT itself does not support this (and neither does Swing), so Thinlet can't add that behavior.



Hello Ulf Dittmer,
I was not aware of the javaranch naming policy before. Thanks for prompting me. Now ive changed it. And also thanks for the reply.
 
Sundar Ram
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer,

We can change the list items color in thinlet. But it has to be specified in the XUL file(foreground attribute of item element) which we create for the interface. But this should be done at design time i.e when we write the code. But i require to change the foreground/background color dynamically at runtime.

-Sundar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!