package com.vci.client.framework.systemConfig.stafforgmanage; import java.awt.Component; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.ListCellRenderer; import com.vci.client.common.objects.UserObject; import com.vci.client.ui.image.BundleImage; public class ListLabelCellRenderForRightRole extends JLabel implements ListCellRenderer { private static final long serialVersionUID = 1L; public ListLabelCellRenderForRightRole() { setOpaque(true); } public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ UserObject entity = (UserObject)value; if(entity != null){ this.setIcon(new BundleImage().createImageIcon("user.gif")); this.setText(entity.toString()); } if(isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } return this; } }