+ private Window newTooltip(final int index, final MouseEvent me) {
+ final T value = ListModel.this.get(index);
+ final Window newTooltip = tooltipCreator.generateTooltip(value, true);
+ if (newTooltip != null) {
+ newTooltip.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ Window promotedTooltip = tooltipCreator
+ .generateTooltip(value, false);
+ if (promotedTooltip != null) {
+ promotedTooltip.setLocation(me.getXOnScreen(),
+ me.getYOnScreen());
+ promotedTooltip.setVisible(true);
+ }
+
+ newTooltip.setVisible(false);
+ }
+ });
+
+ newTooltip.setLocation(me.getXOnScreen(), me.getYOnScreen());
+ showTooltip(newTooltip);
+ }
+
+ return newTooltip;
+ }
+
+ private void showTooltip(Window tooltip) {
+ synchronized (tooltipWatcher) {
+ if (this.tooltip != null) {
+ this.tooltip.setVisible(false);
+ this.tooltip.dispose();
+ }
+
+ this.tooltip = tooltip;
+
+ if (tooltip != null) {
+ tooltip.setVisible(true);
+ }
+ }
+ }
+