/plugins/SVNPlugin/tags/1.6.0/src/ise/plugin/svn/gui/NoWrapCellRenderer.java

# · Java · 26 lines · 19 code · 4 blank · 3 comment · 1 complexity · 7ecf4181d86dc1e18a2d8fe897eb294d MD5 · raw file

  1. package ise.plugin.svn.gui;
  2. import java.awt.*;
  3. import java.util.*;
  4. import javax.swing.*;
  5. import javax.swing.table.*;
  6. import javax.swing.event.*;
  7. import javax.swing.text.html.*;
  8. import org.gjt.sp.jedit.jEdit;
  9. /**
  10. * Non-wrapping text area cell renderer.
  11. */
  12. public class NoWrapCellRenderer extends JTextArea implements TableCellRenderer {
  13. private static Color background = jEdit.getColorProperty( "view.bgColor", Color.WHITE );
  14. private static Color selection = jEdit.getColorProperty( "view.selectionColor", Color.LIGHT_GRAY );
  15. private static Color foreground = jEdit.getColorProperty( "view.fgColor", Color.BLACK );
  16. public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {
  17. setText( value == null ? "" : value.toString().trim() );
  18. setBackground( isSelected ? selection : background );
  19. setForeground( foreground );
  20. return this;
  21. }
  22. }