Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. public class TableCellRender_ControlDocumentos extends DefaultTableCellRenderer{
  2. private int columna ;
  3.  
  4. public TableCellRender_ControlDocumentos(int Colpatron)
  5. {
  6. this.columna = Colpatron;
  7. }
  8.  
  9. @Override
  10. public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column)
  11. {
  12. super.getTableCellRendererComponent(table, value, selected, focused, row, column);
  13.  
  14. JLabel etiqueta = new JLabel();
  15.  
  16. if(columna == 4){
  17. if(selected)
  18. etiqueta.setBackground (Color.CYAN);
  19. else
  20. etiqueta.setBackground (Color.YELLOW);
  21. }
  22.  
  23. if (value instanceof String){
  24. etiqueta.setOpaque(true);
  25. etiqueta.setText((String)value);
  26. }
  27.  
  28. return etiqueta;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement