1 19 package org.openide.explorer.view; 20 21 import org.openide.awt.ListPane; 22 import org.openide.explorer.*; 23 import org.openide.nodes.*; 24 25 import java.awt.*; 26 import java.awt.event.*; 27 28 import java.beans.*; 29 30 import java.io.*; 31 32 import javax.swing.*; 33 34 35 44 45 79 public class IconView extends ListView implements Externalizable { 80 81 static final long serialVersionUID = -9129850245819731264L; 82 83 public IconView() { 84 } 85 86 88 protected JList createList() { 89 JList list = new ListPane() { 90 95 public String getToolTipText(MouseEvent event) { 96 if (event != null) { 97 Point p = event.getPoint(); 98 int index = locationToIndex(p); 99 100 if (index >= 0) { 101 VisualizerNode v = (VisualizerNode) getModel().getElementAt(index); 102 String tooltip = v.getShortDescription(); 103 String displayName = v.getDisplayName(); 104 105 if ((tooltip != null) && !tooltip.equals(displayName)) { 106 return tooltip; 107 } 108 } 109 } 110 111 return null; 112 } 113 }; 114 115 list.setCellRenderer(new NodeRenderer()); 116 117 return list; 118 } 119 } 120 | Popular Tags |