1 19 20 package org.netbeans.modules.websvc.registry.ui; 21 22 import javax.swing.*; 23 import java.awt.Component ; 24 25 import org.openide.ErrorManager; 26 27 31 public class WSListCellRenderer extends JLabel implements ListCellRenderer { 32 private ImageIcon longIcon = null; 33 34 37 public Component getListCellRendererComponent(JList list, 38 Object value, int index, boolean isSelected, boolean cellHasFocus) { 43 String s = value.toString(); 44 setText(s); 45 if (s.equals("<choose>")) { 46 } else { 48 java.net.URL url = getClass().getResource("/org/netbeans/modules/websvc/registry/resources/UDDIRegistry.gif"); 49 if (url != null) { 50 longIcon = new javax.swing.ImageIcon (url); 51 } else { 52 ErrorManager.getDefault().log(ErrorManager.ERROR, "Error loading the resource " + this.toString()); 53 } 54 55 setIcon(longIcon); 56 } 57 58 if (isSelected) { 59 setBackground(list.getSelectionBackground()); 60 setForeground(list.getSelectionForeground()); 61 } else { 62 setBackground(list.getBackground()); 63 setForeground(list.getForeground()); 64 } 65 setEnabled(list.isEnabled()); 66 setFont(list.getFont()); 67 setOpaque(true); 68 return this; 69 } 70 } 71 | Popular Tags |