@Override
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    DefaultListCellRenderer c =
        (DefaultListCellRenderer)
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    MassResult r = (MassResult) value;

    int similarity = r.getSimilarity();

    String text = Integer.toString(similarity);

    c.setText(text);

    BufferedImage thumb = r.getThumbnail();

    c.setIcon(new ImageIcon(thumb));

    c.setBorder(border);

    c.setOpaque(isSelected);

    c.setToolTipText((r.isMalignant() ? "Malignant" : "Benign") + ", Similarity: " + text);

    return c;
  }
 @Override
 public Component getListCellRendererComponent(
     JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   QuestNode node = (QuestNode) value;
   if (node != null) {
     super.setIcon(node.getIcon(false));
     super.setText(node.toString());
   }
   return this;
 }
Пример #3
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends SaveLayerInfo> list,
     SaveLayerInfo info,
     int index,
     boolean isSelected,
     boolean cellHasFocus) {
   def.setIcon(info.getLayer().getIcon());
   def.setText(info.getName());
   return def;
 }