1 22 package org.objectweb.petals.engine.sampleclient.gui.model; 23 24 import java.awt.Component ; 25 26 import javax.swing.JLabel ; 27 import javax.swing.JList ; 28 import javax.swing.ListCellRenderer ; 29 30 35 public class ServiceListRenderer implements ListCellRenderer { 36 37 private ListCellRenderer listCellRenderer; 38 39 public ServiceListRenderer(ListCellRenderer defaultCellRenderer) { 40 this.listCellRenderer = defaultCellRenderer; 41 } 42 43 public Component getListCellRendererComponent(JList list, Object value, 44 int index, boolean isSelected, boolean cellHasFocus) { 45 JLabel component = (JLabel ) listCellRenderer 46 .getListCellRendererComponent(list, value, index, isSelected, 47 cellHasFocus); 48 if (value instanceof JLabel ) { 49 component.setText(((JLabel ) value).getText()); 50 component.setToolTipText(((JLabel ) value).getToolTipText()); 51 } 52 return component; 53 } 54 55 } 56 | Popular Tags |