• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thinlet Question

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic