src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -232,18 +232,20 @@
lookInLabel = new JLabel(lookInLabelText);
lookInLabel.setDisplayedMnemonic(lookInLabelMnemonic);
topPanel.add(lookInLabel, BorderLayout.BEFORE_LINE_BEGINS);
// CurrentDir ComboBox
- directoryComboBox = new JComboBox() {
+ @SuppressWarnings("serial") // anonymous class
+ JComboBox tmp1 = new JComboBox() {
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
// Must be small enough to not affect total width.
d.width = 150;
return d;
}
};
+ directoryComboBox = tmp1;
directoryComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
lookInLabelText);
directoryComboBox.putClientProperty( "JComboBox.isTableCellEditor", Boolean.TRUE );
lookInLabel.setLabelFor(directoryComboBox);
directoryComboBoxModel = createDirectoryComboBoxModel(fc);
@@ -378,15 +380,17 @@
fileNameLabel = new AlignedLabel();
populateFileNameLabel();
fileNamePanel.add(fileNameLabel);
- fileNameTextField = new JTextField(35) {
+ @SuppressWarnings("serial") // anonymous class
+ JTextField tmp2 = new JTextField(35) {
public Dimension getMaximumSize() {
return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
}
};
+ fileNameTextField = tmp2;
fileNamePanel.add(fileNameTextField);
fileNameLabel.setLabelFor(fileNameTextField);
fileNameTextField.addFocusListener(
new FocusAdapter() {
public void focusGained(FocusEvent e) {
@@ -532,10 +536,11 @@
public SingleClickListener(JList list) {
}
}
// 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
@@ -851,10 +856,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) {
@@ -908,10 +914,11 @@
}
/**
* Data model for a type-face selection combo-box.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object> {
Vector<File> directories = new Vector<File>();
int[] depths = null;
File selectedDirectory = null;
JFileChooser chooser = getFileChooser();
@@ -1040,10 +1047,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) {
@@ -1065,10 +1073,11 @@
}
/**
* Data model for a type-face selection combo-box.
*/
+ @SuppressWarnings("serial") // anonymous class
protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
protected JFileChooser getFileChooser() {
return MetalFileChooserUI.this.getFileChooser();
}
}
@@ -1082,10 +1091,11 @@
}
/**
* Acts when DirectoryComboBox has changed the selected item.
*/
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxAction extends AbstractAction {
protected DirectoryComboBoxAction() {
super("DirectoryComboBoxAction");
}
@@ -1182,10 +1192,11 @@
for (int i = 0; i < group.length; i++) {
group[i].group = group;
}
}
+ @SuppressWarnings("serial") // Superclass is not serializable across versions
private class AlignedLabel extends JLabel {
private AlignedLabel[] group;
private int maxWidth = 0;
AlignedLabel() {