KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwtx > swing > table > DefaultTableCellRenderer


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: DefaultTableCellRenderer.java,v $
11    Revision 1.4 2004/03/30 10:42:47 bobintetley
12    Many minor bug fixes, event improvements by Dan Naab. Full swing.Icon support
13
14    Revision 1.3 2004/01/26 08:11:14 bobintetley
15    Many bugfixes and addition of SwingSet
16
17    Revision 1.2 2003/12/14 09:13:39 bobintetley
18    Added CVS log to source headers
19
20 */

21
22 package swingwtx.swing.table;
23
24 import swingwtx.swing.*;
25 import swingwt.awt.*;
26
27 public class DefaultTableCellRenderer extends JLabel implements TableCellRenderer {
28     
29      public Component getTableCellRendererComponent(JTable table, Object JavaDoc value, boolean isSelected, boolean hasFocus, int row, int column) {
30
31         setValue(value);
32     return this;
33     }
34      
35     protected void setValue(Object JavaDoc value) {
36         if (value instanceof Icon)
37             setIcon((Icon) value);
38         else
39             setText( (value == null) ? "" : value.toString() );
40     }
41     
42 }
43
Popular Tags