src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2013, 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
--- 1,7 ----
/*
! * 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,249 ****
lookInLabel = new JLabel(lookInLabelText);
lookInLabel.setDisplayedMnemonic(lookInLabelMnemonic);
topPanel.add(lookInLabel, BorderLayout.BEFORE_LINE_BEGINS);
// CurrentDir ComboBox
! directoryComboBox = new JComboBox() {
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
// Must be small enough to not affect total width.
d.width = 150;
return d;
}
};
directoryComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
lookInLabelText);
directoryComboBox.putClientProperty( "JComboBox.isTableCellEditor", Boolean.TRUE );
lookInLabel.setLabelFor(directoryComboBox);
directoryComboBoxModel = createDirectoryComboBoxModel(fc);
--- 232,251 ----
lookInLabel = new JLabel(lookInLabelText);
lookInLabel.setDisplayedMnemonic(lookInLabelMnemonic);
topPanel.add(lookInLabel, BorderLayout.BEFORE_LINE_BEGINS);
// CurrentDir ComboBox
! @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,392 ****
fileNameLabel = new AlignedLabel();
populateFileNameLabel();
fileNamePanel.add(fileNameLabel);
! fileNameTextField = new JTextField(35) {
public Dimension getMaximumSize() {
return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
}
};
fileNamePanel.add(fileNameTextField);
fileNameLabel.setLabelFor(fileNameTextField);
fileNameTextField.addFocusListener(
new FocusAdapter() {
public void focusGained(FocusEvent e) {
--- 380,396 ----
fileNameLabel = new AlignedLabel();
populateFileNameLabel();
fileNamePanel.add(fileNameLabel);
! @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,541 ****
--- 536,546 ----
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,860 ****
--- 856,866 ----
}
//
// 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,917 ****
--- 914,924 ----
}
/**
* 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,1049 ****
--- 1047,1057 ----
}
/**
* 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,1074 ****
--- 1073,1083 ----
}
/**
* Data model for a type-face selection combo-box.
*/
+ @SuppressWarnings("serial") // Same-version serialization only
protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
protected FileFilter[] filters;
protected FilterComboBoxModel() {
super();
filters = getFileChooser().getChoosableFileFilters();
*** 1142,1151 ****
--- 1151,1161 ----
}
/**
* 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");
}
*** 1242,1251 ****
--- 1252,1262 ----
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() {