Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 private static JButton getButton(JList list, Point pt, int index) {
   Container c =
       (Container)
           list.getCellRenderer().getListCellRendererComponent(list, "", index, false, false);
   Rectangle r = list.getCellBounds(index, index);
   c.setBounds(r);
   // c.doLayout(); //may be needed for mone LayoutManager
   pt.translate(-r.x, -r.y);
   Component b = SwingUtilities.getDeepestComponentAt(c, pt.x, pt.y);
   if (b instanceof JButton) {
     return (JButton) b;
   } else {
     return null;
   }
 }