jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
changeset 25565 ce603b34c98d
parent 24969 afa6934dd8e8
equal deleted inserted replaced
25564:871d3490f14d 25565:ce603b34c98d
   434         }
   434         }
   435         return handler;
   435         return handler;
   436     }
   436     }
   437 
   437 
   438     protected MouseListener createDoubleClickListener(JFileChooser fc,
   438     protected MouseListener createDoubleClickListener(JFileChooser fc,
   439                                                       JList list) {
   439                                                       JList<?> list) {
   440         return new Handler(list);
   440         return new Handler(list);
   441     }
   441     }
   442 
   442 
   443     public ListSelectionListener createListSelectionListener(JFileChooser fc) {
   443     public ListSelectionListener createListSelectionListener(JFileChooser fc) {
   444         return getHandler();
   444         return getHandler();
   445     }
   445     }
   446 
   446 
   447     private class Handler implements MouseListener, ListSelectionListener {
   447     private class Handler implements MouseListener, ListSelectionListener {
   448         JList list;
   448         JList<?> list;
   449 
   449 
   450         Handler() {
   450         Handler() {
   451         }
   451         }
   452 
   452 
   453         Handler(JList list) {
   453         Handler(JList<?> list) {
   454             this.list = list;
   454             this.list = list;
   455         }
   455         }
   456 
   456 
   457         public void mouseClicked(MouseEvent evt) {
   457         public void mouseClicked(MouseEvent evt) {
   458             // Note: we can't depend on evt.getSource() because of backward
   458             // Note: we can't depend on evt.getSource() because of backward
   504 
   504 
   505         public void valueChanged(ListSelectionEvent evt) {
   505         public void valueChanged(ListSelectionEvent evt) {
   506             if(!evt.getValueIsAdjusting()) {
   506             if(!evt.getValueIsAdjusting()) {
   507                 JFileChooser chooser = getFileChooser();
   507                 JFileChooser chooser = getFileChooser();
   508                 FileSystemView fsv = chooser.getFileSystemView();
   508                 FileSystemView fsv = chooser.getFileSystemView();
   509                 JList list = (JList)evt.getSource();
   509                 @SuppressWarnings("unchecked")
       
   510                 JList<?> list = (JList)evt.getSource();
   510 
   511 
   511                 int fsm = chooser.getFileSelectionMode();
   512                 int fsm = chooser.getFileSelectionMode();
   512                 boolean useSetDirectory = usesSingleFilePane &&
   513                 boolean useSetDirectory = usesSingleFilePane &&
   513                                           (fsm == JFileChooser.FILES_ONLY);
   514                                           (fsm == JFileChooser.FILES_ONLY);
   514 
   515 
   568         // NOTE: This class exists only for backward compatibility. All
   569         // NOTE: This class exists only for backward compatibility. All
   569         // its functionality has been moved into Handler. If you need to add
   570         // its functionality has been moved into Handler. If you need to add
   570         // new functionality add it to the Handler, but make sure this
   571         // new functionality add it to the Handler, but make sure this
   571         // class calls into the Handler.
   572         // class calls into the Handler.
   572         Handler handler;
   573         Handler handler;
   573         public  DoubleClickListener(JList list) {
   574         public  DoubleClickListener(JList<?> list) {
   574             handler = new Handler(list);
   575             handler = new Handler(list);
   575         }
   576         }
   576 
   577 
   577         /**
   578         /**
   578          * The JList used for representing the files is created by subclasses, but the
   579          * The JList used for representing the files is created by subclasses, but the