companylistcellrenderer.java

来自「基于Struts的客户资料管理系统」· Java 代码 · 共 43 行

JAVA
43
字号
package net.robin.crm.ui;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.ImageIcon;
import javax.swing.JList;

public class CompanyListCellRenderer extends DefaultListCellRenderer {

	private ImageIcon companyIcon;
	
	public CompanyListCellRenderer() {
		super();
	}

	public Component getListCellRendererComponent(
			JList list, 
			Object value,
			int index, 
			boolean isSelected,
			boolean cellHasFocus) {
		
		super.getListCellRendererComponent(list, value, index, isSelected,
				cellHasFocus);
		
		if(companyIcon!=null)
			setIcon(companyIcon);
		
		return this;
	}

	public ImageIcon getCompanyIcon() {
		return companyIcon;
	}

	public void setCompanyIcon(ImageIcon companyIcon) {
		this.companyIcon = companyIcon;
	}

	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?