I don't know why u guys are understanding what I want:-
If ( column == 1 && value.equals("FATAL") {
setBackground(Color.red);
}
Now how come the whole row will be in red color.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 9:01 AM
To: Bhangale, Bhushan
Subject: RE: JTable row renderer
Hi
The cell renderer has a method called getTableCellRendererComponent. u have
to override that. see the code below for a sample. I have done that and itz
working.
class CustomCellRenderer extends
DefaultTableCellRenderer
{
public CustomCellRenderer()
{
}
public Component getTableCellRendererComponent( JTable table,Object value,
boolean isSelected, boolean hasFocus, int row, int column ) { if (column ==
0 || column == 1) { setBackground(new Color(64,128,128));
setForeground(Color.white); setFont(new Font("arial", Font.BOLD, 13)); }
super.getTableCellRendererComponent(table,value,
isSelected, hasFocus, row, column );
if (column == 0 || column == 1)
setFont(new Font("arial", Font.BOLD, 13));
return this;
}
Raji
--- "Bhangale, Bhushan" <[EMAIL PROTECTED]>
wrote:
> That I also know that I have to do for row. I want
> to know how??
>
> -----Original Message-----
> From: Krishnakumar CS [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 30, 2002 8:35 AM
> To: 'Bhangale, Bhushan'; '[EMAIL PROTECTED]'
> Subject: RE: JTable row renderer
>
>
> Fine, but there is no row renderer. So you have to
> do it for all the cells
> in the row
>
> -----Original Message-----
> From: Bhangale, Bhushan
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 30, 2002 5:42 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: JTable row renderer
>
>
> I did that but its a cell renderer not a row
> renderer. I want a full row to
> get colored depending upon a column value.
> -----Original Message-----
> From: Vikram Kumar [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 11:00 PM
> To: Bhangale, Bhushan
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: JTable row renderer
>
>
> Hi!
> You will have to override the TableCellRenderer for
> that and set the
> background.. Have you tried doing that ???
>
> vikram
>
> Bhangale, Bhushan wrote:
>
>
> Hi All,
>
> I want to color a row based on time. I have four
> columns in a row in which
> one column is storing time. I want to highlight the
> whole row say till 1
> minute. When I get a data from my application I
> store it in TableModel with
> the time column holding the value of time when the
> record arrived. Now till
> that time to say 1 minute the row should be
> highlighted.
>
> Please help, it is urgent.
>
> Thanks & Regards
> Bhushan Bhangale
> Sr. Software Engineer
> Fusion Infotech India Private Ltd.
> Ph. no. - 1-212-641-6932 (O)
>
>
>
>
> "The information in this e-mail, and any attachment
> therein, is
>
> confidential and for use by the addressee only. If
> you are not the
>
> intended recipient, please return the e-mail to the
> sender and delete
>
> it from your computer. Although The Bank of New York
> attempts to
>
> sweep e-mail and attachments for viruses, it does
> not guarantee that
>
> either are virus-free and accepts no liability for
> any damage sustained
>
> as a result of viruses."
>
>
>
>
>
> "The information in this e-mail, and any attachment
> therein, is
>
> confidential and for use by the addressee only. If
> you are not the
>
> intended recipient, please return the e-mail to the
> sender and delete
>
> it from your computer. Although The Bank of New York
> attempts to
>
> sweep e-mail and attachments for viruses, it does
> not guarantee that
>
> either are virus-free and accepts no liability for
> any damage sustained
>
> as a result of viruses."
>
>
>
>
> "The information in this e-mail, and any attachment
> therein, is
> confidential and for use by the addressee only. If
> you are not the
> intended recipient, please return the e-mail to the
> sender and delete
> it from your computer. Although The Bank of New York
> attempts to
> sweep e-mail and attachments for viruses, it does
> not guarantee that
> either are virus-free and accepts no liability for
> any damage sustained
> as a result of viruses."
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
"The information in this e-mail, and any attachment therein, is
confidential and for use by the addressee only. If you are not the
intended recipient, please return the e-mail to the sender and delete
it from your computer. Although The Bank of New York attempts to
sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained
as a result of viruses."
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing