/[classpath]/classpath/javax/swing/table/DefaultTableCellRenderer.java
ViewVC logotype

Diff of /classpath/javax/swing/table/DefaultTableCellRenderer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by rabbit78, Fri Nov 4 14:47:41 2005 UTC revision 1.22 by rabbit78, Fri Nov 4 15:10:20 2005 UTC
# Line 50  import javax.swing.UIManager; Line 50  import javax.swing.UIManager;
50  import javax.swing.border.Border;  import javax.swing.border.Border;
51  import javax.swing.border.EmptyBorder;  import javax.swing.border.EmptyBorder;
52  import javax.swing.JTextField;  import javax.swing.JTextField;
 import javax.swing.plaf.ColorUIResource;  
53    
54  /**  /**
55   * Class to display every cells.   * Class to display every cells.
# Line 120  public class DefaultTableCellRenderer ex Line 119  public class DefaultTableCellRenderer ex
119    public void updateUI()    public void updateUI()
120    {    {
121      super.updateUI();      super.updateUI();
122        background = null;
123        foreground = null;
124    }    }
125    
126    /**    /**
# Line 171  public class DefaultTableCellRenderer ex Line 172  public class DefaultTableCellRenderer ex
172      if (hasFocus)      if (hasFocus)
173        {        {
174          setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));          setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
175          super.setBackground(UIManager.getColor("Table.focusCellBackground"));          if (table.isCellEditable(row, column))
176          super.setForeground(UIManager.getColor("Table.focusCellForeground"));            {
177                super.setBackground(UIManager.getColor("Table.focusCellBackground"));
178                super.setForeground(UIManager.getColor("Table.focusCellForeground"));
179              }
180        }        }
181      else      else
182        setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));        setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
# Line 180  public class DefaultTableCellRenderer ex Line 184  public class DefaultTableCellRenderer ex
184      setEnabled(table.isEnabled());      setEnabled(table.isEnabled());
185      setFont(table.getFont());      setFont(table.getFont());
186    
187        // If the current background is equal to the table's background, then we
188        // can avoid filling the background by setting the renderer opaque.
189        Color back = getBackground();
190        setOpaque(back != null && back.equals(table.getBackground()));
191        
192      return this;          return this;    
193    }    }
194    

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26