View Javadoc
1   //
2   // $Id: JUploadApplet.java 88 2007-05-02 00:04:52Z
3   // /C=DE/ST=Baden-Wuerttemberg/O=ISDN4Linux/OU=Fritz
4   // Elfert/CN=svn-felfert@isdn4linux.de/emailAddress=fritz@fritz-elfert.de $
5   //
6   // jupload - A file upload applet.
7   // Copyright 2007 The JUpload Team
8   //
9   // Created: 2007-04-28
10  // Creator: felfert
11  // Last modified: $Date$
12  //
13  // This program is free software; you can redistribute it and/or modify it under
14  // the terms of the GNU General Public License as published by the Free Software
15  // Foundation; either version 2 of the License, or (at your option) any later
16  // version. This program is distributed in the hope that it will be useful, but
17  // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19  // details. You should have received a copy of the GNU General Public License
20  // along with this program; if not, write to the Free Software Foundation, Inc.,
21  // 675 Mass Ave, Cambridge, MA 02139, USA.
22  
23  package wjhk.jupload2.gui.filepanel;
24  
25  import java.awt.Component;
26  
27  import javax.swing.JTable;
28  import javax.swing.table.DefaultTableCellRenderer;
29  
30  /**
31   * Technical class, used to add tooltips to names. Used in
32   * {@link wjhk.jupload2.gui.filepanel.FilePanelJFlatTable}.
33   * 
34   * @author felfert
35   */
36  public class NameRenderer extends DefaultTableCellRenderer {
37  
38      /** A generated serialVersionUID, to avoid warning during compilation */
39      private static final long serialVersionUID = -3096051530077250460L;
40  
41      /**
42       * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
43       *      java.lang.Object, boolean, boolean, int, int)
44       */
45      @Override
46      public Component getTableCellRendererComponent(JTable table, Object value,
47              boolean isSelected, boolean hasFocus, int row, int column) {
48          Component cell = super.getTableCellRendererComponent(table, value,
49                  isSelected, hasFocus, row, column);
50  
51          if (value instanceof String) {
52              setToolTipText((String) value);
53          }
54          return cell;
55      }
56  }