我目前正在研究 salomé tmf 项目,所以我在编译后下载了代码我收到了这个错误:
The interface ListCellRenderer cannot be implemented more than once with different
arguments: ListCellRenderer<Object> and ListCellRenderer UserListRenderer.java
但我找不到问题到底出在哪里。 这是 UserListRenderer 类的代码:
package org.objectweb.salome_tmf.ihm.admin.models;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.UIManager;
import org.objectweb.salome_tmf.api.ApiConstants;
import org.objectweb.salome_tmf.api.Util;
import org.objectweb.salome_tmf.data.AdminProjectData;
import org.objectweb.salome_tmf.data.User;
import org.objectweb.salome_tmf.ihm.IHMConstants;
import org.objectweb.salome_tmf.ihm.tools.Tools;
public class UserListRenderer extends DefaultListCellRenderer implements
ListCellRenderer, ApiConstants , IHMConstants{
/**
* Le s?parateur de fichier
*/
/**
* M?thode qui red?finit le renderer des ?l?ments de la liste
* @param list la liste concern?e
* @param value l'objet dans la liste
* @param index indice dans la liste
* @param isSelected si l'objet est s?lectionn?
* @param cellHasFocus si le focus est sur la cellule
*/
public Component getListCellRendererComponent(JList list, Object value, int index,
boolean isSelected,
boolean cellHasFocus) {
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
}
else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
Icon icon;
if (value instanceof User) {
icon = Tools.createAppletImageIcon(PATH_TO_ADMIN_ICON,"");
setIcon(icon);
setText(((User)value).getLoginFromModel() + " / " +
((User)value).getLastNameFromModel() + " " +
((User)value).getFirstNameFromModel());
} else if (value instanceof Icon) {
setIcon((Icon)value);
setText("");
} else {
setIcon(null);
setText((value == null) ? "" : value.toString());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
setBorder((cellHasFocus) ? UIManager.getBorder("List.focusCellHighlightBorder") :
noFocusBorder);
return this;
} // Fin de la m?thode getListCellRendererComponent/5
} // Fin de la classe UserListRenderer
任何帮助将不胜感激
干杯