Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/09/2005, 14:42
MikiBroki
 
Fecha de Ingreso: abril-2002
Mensajes: 1.014
Antigüedad: 22 años, 1 mes
Puntos: 8
Bueno continuando en esta lucha he conseguido que al hacer click en la fila se me resalte sólo mientras el botón del ratón está pulsado:

Este sería el código en el JFrame:


Código:
  
public void valueChanged(ListSelectionEvent e)
{
    
if (this.escuchador != null)
{    

    if (e.getValueIsAdjusting())
        return;        
      
    ListSelectionModel m = (ListSelectionModel) e.getSource();      
  
    this.mt1.fireTableDataChanged();
       
}

Este el del render:


Código:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
  
    this.etiqueta.setOpaque(true);
  
    
    if (isSelected)
    {
      this.etiqueta.setBackground(Color.red);
    }
    else
    {
      this.etiqueta.setBackground(Color.ORANGE);
    }
    
    
    this.etiqueta.setText(value.toString());
        
    return etiqueta;
    
  }
¿Cómo podría mantenerla seleccionada?