File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [B&S] DefaultTableCellRenderer and awt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[B&S] DefaultTableCellRenderer and awt" Watch "[B&S] DefaultTableCellRenderer and awt" New topic

[B&S] DefaultTableCellRenderer and awt

Marco Santinon

Joined: Jan 03, 2007
Posts: 17
Hi all,
I used a custom DefaultTableCellRenderer to display altern color lines in the JTable.
To do this, I had to override method

public java.awt.Component getTableCellRendererComponent(JTable table,
Object value,
boolean selected,
boolean focus,
int row,
int col)

but it returns a java.awt.Component!

Can this cause trouble with the request of not use java.awt.Component?

Tecnically speaking I'm not using it, but it is in the import!

What do you think?

Thanks in advance

Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516

I think the requirement is to "not use the AWT components" when the quivalent is available in SWING...

I would say you can use this unless there's an upgrade for it in SWING. Virtually all SWING classes inherits java.awt.Component, this is not a problem..

Example: you cannot t use Button since JButton exists..

Marco Santinon

Joined: Jan 03, 2007
Posts: 17

I agree. Here's the link:
subject: [B&S] DefaultTableCellRenderer and awt
It's not a secret anymore!