package jas2.hist;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
public class FunctionListCellRenderer extends DefaultListCellRenderer
{
public Component getListCellRendererComponent(JList list,
Object value, // value to display
int index, // cell index
boolean isSelected, // is the cell selected
boolean cellHasFocus) // the list and the cell have the focus
{
super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
if (value instanceof FunctionFactory)
{
FunctionFactory ff = (FunctionFactory) value;
setText(ff.getFunctionName());
setIcon(ff.getFunctionIcon());
}
return this;
}
}
Ads help maintain this website.