< prev index next >

## src/java.desktop/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java

Print this page

    rev 48358 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.

    @@ -832,16 +832,18 @@

             public int getDepth(int i) {
                 return (depths != null && i >= 0 && i < depths.length) ? depths[i] : 0;
             }

    -        public void setSelectedItem(Object selectedDirectory) {
    -            this.selectedDirectory = (File)selectedDirectory;
    +        @Override
    +        public void setSelectedItem(File selectedDirectory) {
    +            this.selectedDirectory = selectedDirectory;
                 fireContentsChanged(this, -1, -1);
             }

    -        public Object getSelectedItem() {
    +        @Override
    +        public File getSelectedItem() {
                 return selectedDirectory;
             }

             public int getSize() {
                 return directories.size();

    @@ -933,18 +935,18 @@
                 } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
                     fireContentsChanged(this, -1, -1);
                 }
             }

    -        public void setSelectedItem(Object filter) {
    +        public void setSelectedItem(FileFilter filter) {
                 if(filter != null) {
    -                getFileChooser().setFileFilter((FileFilter) filter);
    +                getFileChooser().setFileFilter(filter);
                     fireContentsChanged(this, -1, -1);
                 }
             }

    -        public Object getSelectedItem() {
    +        public FileFilter getSelectedItem() {
                 // Ensure that the current filter is in the list.
                 // NOTE: we shouldnt' have to do this, since JFileChooser adds
                 // the filter to the choosable filters list when the filter
                 // is set. Lets be paranoid just in case someone overrides
                 // setFileFilter in JFileChooser.

< prev index next >