(Answer) (Category) FAQ-O-Matic : (Category) dbSwing :
How do I color a cell of a JdbTable?
Q: How do I color a cell in a JdbTable?

A: Use a column paint listener:

column1.addColumnPaintListener(
  new com.borland.dx.dataset.ColumnPaintAdapter() 
  {
    public void painting(DataSet dataSet, 
                         Column column, 
                         int row, 
                         Variant value, 
                         CustomPaintSite paintSite) 
       {
         column1_painting(dataSet, column, row, value, paintSite);
       }
  });


void column1_painting(DataSet dataSet, 
                      Column column, 
                      int row, 
                      Variant value, 
                      CustomPaintSite paintSite) 
     {
       // paint odd values red, even values green
       if ((value.getShort() & 0x1) == 1) 
       {
         paintSite.setBackground(Color.red);
       }
       else 
       {
         paintSite.setBackground(Color.green);
       }
     }


This example was originally contributed to the borland.public.jbuilder.dbswing newsgroup by TeamB member Tad Frysinger

Original newsgroup article: 

http://groups.google.com/groups?hl=en&selm=MPG.13de25dcd1ab486998969f%40forums.inprise.com
[Append to This Answer]
dave@davenet.net
2002-May-09 3:18pm
This document is: http://www.visi.com/~gyles19/cgi-bin/fom.cgi?file=400
[Search] [Appearance]
This is a Faq-O-Matic 2.709.
This FAQ administered by gyles19@visi.com.

Other JBuilder Links

Java Community
Java Tools
Code Central
JB OpenTools
Community
Recent
Threads
Borland Chat
Chat FAQ
Feature Matrices
3.0 |  3.5 |  4.0
5.0 |  6.0 |  7.0
Shop for
JBuilder
JBuilder
Downloads
and reg keys
Report Piracy
Online Manuals
4.0 |  5.0 |  6.0
7.0
Borland
DevSupport's
Bug/RFE Form

Quality Central Client
JB Patches &
Updates
JBuilder FAQs TIs
JBuilder
Newsgroups
Tamaracka's
News Archive
Mr. Haki's
JBuilder Machine
JGuru's
JBuilder FAQ
Sun's Bug
Parade
Netring Home - About - Privacy
The
JBuilder Netring Logo
The Borland JBuilder Netring by JBuilder FAQ-O-Matic
[ Join Now | List Sites | Random | << Prev | Next >> ]
[ Previous 5 Sites | Skip Previous | Skip Next | Next 5 Sites ]