src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -223,11 +223,12 @@
 
         // Add the top panel to the fileChooser
         fc.add(topPanel, BorderLayout.NORTH);
 
         // ComboBox Label
-        lookInLabel = new JLabel(lookInLabelText, JLabel.TRAILING) {
+        @SuppressWarnings("serial") // anonymous class
+        JLabel tmp1 = new JLabel(lookInLabelText, JLabel.TRAILING) {
             public Dimension getPreferredSize() {
                 return getMinimumSize();
             }
 
             public Dimension getMinimumSize() {

@@ -236,18 +237,20 @@
                     d.width = Math.max(d.width, placesBar.getWidth());
                 }
                 return d;
             }
         };
+        lookInLabel = tmp1;
         lookInLabel.setDisplayedMnemonic(lookInLabelMnemonic);
         lookInLabel.setAlignmentX(JComponent.LEFT_ALIGNMENT);
         lookInLabel.setAlignmentY(JComponent.CENTER_ALIGNMENT);
         topPanel.add(lookInLabel);
         topPanel.add(Box.createRigidArea(new Dimension(8,0)));
 
         // CurrentDir ComboBox
-        directoryComboBox = new JComboBox<File>() {
+        @SuppressWarnings("serial") // anonymous class
+        JComboBox<File> tmp2 = new JComboBox<File>() {
             public Dimension getMinimumSize() {
                 Dimension d = super.getMinimumSize();
                 d.width = 60;
                 return d;
             }

@@ -257,10 +260,11 @@
                 // Must be small enough to not affect total width.
                 d.width = 150;
                 return d;
             }
         };
+        directoryComboBox = tmp2;
         directoryComboBox.putClientProperty( "JComboBox.lightweightKeyboardNavigation", "Lightweight" );
         lookInLabel.setLabelFor(directoryComboBox);
         directoryComboBoxModel = createDirectoryComboBoxModel(fc);
         directoryComboBox.setModel(directoryComboBoxModel);
         directoryComboBox.addActionListener(directoryComboBoxAction);

@@ -414,16 +418,17 @@
         // file entry and filters
         JPanel fileAndFilterPanel = new JPanel();
         fileAndFilterPanel.add(Box.createRigidArea(vstrut8));
         fileAndFilterPanel.setLayout(new BoxLayout(fileAndFilterPanel, BoxLayout.Y_AXIS));
 
-
-        filenameTextField = new JTextField(35) {
+        @SuppressWarnings("serial") // anonymous class
+        JTextField tmp3 = new JTextField(35) {
             public Dimension getMaximumSize() {
                 return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
             }
         };
+        filenameTextField = tmp3;
 
         fileNameLabel.setLabelFor(filenameTextField);
         filenameTextField.addFocusListener(
             new FocusAdapter() {
                 public void focusGained(FocusEvent e) {

@@ -454,16 +459,18 @@
         getBottomPanel().add(Box.createRigidArea(new Dimension(30, 0)));
 
         // buttons
         getButtonPanel().setLayout(new BoxLayout(getButtonPanel(), BoxLayout.Y_AXIS));
 
-        approveButton = new JButton(getApproveButtonText(fc)) {
+        @SuppressWarnings("serial") // anonymous class
+        JButton tmp4 = new JButton(getApproveButtonText(fc)) {
             public Dimension getMaximumSize() {
                 return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ?
                        approveButton.getPreferredSize() : cancelButton.getPreferredSize();
             }
         };
+        approveButton = tmp4;
         Insets buttonMargin = approveButton.getMargin();
         buttonMargin = new InsetsUIResource(buttonMargin.top,    buttonMargin.left  + 5,
                                             buttonMargin.bottom, buttonMargin.right + 5);
         approveButton.setMargin(buttonMargin);
         approveButton.setMnemonic(getApproveButtonMnemonic(fc));

@@ -471,16 +478,18 @@
         approveButton.setToolTipText(getApproveButtonToolTipText(fc));
         getButtonPanel().add(Box.createRigidArea(vstrut6));
         getButtonPanel().add(approveButton);
         getButtonPanel().add(Box.createRigidArea(vstrut4));
 
-        cancelButton = new JButton(cancelButtonText) {
+        @SuppressWarnings("serial") // anonymous class
+        JButton tmp5 = new JButton(cancelButtonText) {
             public Dimension getMaximumSize() {
                 return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ?
                        approveButton.getPreferredSize() : cancelButton.getPreferredSize();
             }
         };
+        cancelButton = tmp5;
         cancelButton.setMargin(buttonMargin);
         cancelButton.setToolTipText(cancelButtonToolTipText);
         cancelButton.addActionListener(getCancelSelectionAction());
         getButtonPanel().add(cancelButton);
 

@@ -587,18 +596,20 @@
     public ListSelectionListener createListSelectionListener(JFileChooser fc) {
         return super.createListSelectionListener(fc);
     }
 
     // Obsolete class, not used in this version.
+    @SuppressWarnings("serial")
     protected class WindowsNewFolderAction extends NewFolderAction {
     }
 
     // Obsolete class, not used in this version.
     protected class SingleClickListener extends MouseAdapter {
     }
 
     // Obsolete class, not used in this version.
+    @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class FileRenderer extends DefaultListCellRenderer  {
     }
 
     public void uninstallUI(JComponent c) {
         // Remove listeners

@@ -915,10 +926,11 @@
 
     protected DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc) {
         return new DirectoryComboBoxRenderer();
     }
 
+    @SuppressWarnings("serial") // anonymous class
     private static JButton createToolButton(Action a, Icon defaultIcon, String toolTipText, String accessibleName) {
         final JButton result = new JButton(a);
 
         result.setText(null);
         result.setIcon(defaultIcon);

@@ -977,10 +989,11 @@
     }
 
     //
     // Renderer for DirectoryComboBox
     //
+    @SuppressWarnings("serial") // Superclass is not serializable across versions
     class DirectoryComboBoxRenderer extends DefaultListCellRenderer  {
         IndentIcon ii = new IndentIcon();
         public Component getListCellRendererComponent(JList list, Object value,
                                                       int index, boolean isSelected,
                                                       boolean cellHasFocus) {

@@ -1034,10 +1047,11 @@
     }
 
     /**
      * Data model for a type-face selection combo-box.
      */
+    @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
         Vector<File> directories = new Vector<File>();
         int[] depths = null;
         File selectedDirectory = null;
         JFileChooser chooser = getFileChooser();

@@ -1166,10 +1180,11 @@
     }
 
     /**
      * Render different type sizes and styles.
      */
+    @SuppressWarnings("serial") // Superclass is not serializable across versions
     public class FilterComboBoxRenderer extends DefaultListCellRenderer {
         public Component getListCellRendererComponent(JList list,
             Object value, int index, boolean isSelected,
             boolean cellHasFocus) {
 

@@ -1191,10 +1206,11 @@
     }
 
     /**
      * Data model for a type-face selection combo-box.
      */
+    @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
             PropertyChangeListener {
         protected FileFilter[] filters;
         protected FilterComboBoxModel() {
             super();