@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;
 }
Ejemplo n.º 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;
 }
        @Override
        public Component getListCellRendererComponent(
            JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
          if (AntialiasingType.SUBPIXEL.equals(value)) {
            ourDefaultListCellRenderer.putClientProperty(
                SwingUtilities2.AA_TEXT_PROPERTY_KEY,
                new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, 140));
          } else if (AntialiasingType.GREYSCALE.equals(value)) {
            ourDefaultListCellRenderer.putClientProperty(
                SwingUtilities2.AA_TEXT_PROPERTY_KEY,
                new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_ON, 140));
          } else if (AntialiasingType.OFF.equals(value)) {
            ourDefaultListCellRenderer.putClientProperty(
                SwingUtilities2.AA_TEXT_PROPERTY_KEY, null);
          }

          ourDefaultListCellRenderer.setText(value.toString());

          return ourDefaultListCellRenderer;
        }