src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 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) 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,233 ****
// Add the top panel to the fileChooser
fc.add(topPanel, BorderLayout.NORTH);
// ComboBox Label
! lookInLabel = new JLabel(lookInLabelText, JLabel.TRAILING) {
public Dimension getPreferredSize() {
return getMinimumSize();
}
public Dimension getMinimumSize() {
--- 223,234 ----
// Add the top panel to the fileChooser
fc.add(topPanel, BorderLayout.NORTH);
// ComboBox Label
! @SuppressWarnings("serial") // anonymous class
! JLabel tmp1 = new JLabel(lookInLabelText, JLabel.TRAILING) {
public Dimension getPreferredSize() {
return getMinimumSize();
}
public Dimension getMinimumSize() {
*** 236,253 ****
d.width = Math.max(d.width, placesBar.getWidth());
}
return d;
}
};
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>() {
public Dimension getMinimumSize() {
Dimension d = super.getMinimumSize();
d.width = 60;
return d;
}
--- 237,256 ----
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
! @SuppressWarnings("serial") // anonymous class
! JComboBox<File> tmp2 = new JComboBox<File>() {
public Dimension getMinimumSize() {
Dimension d = super.getMinimumSize();
d.width = 60;
return d;
}
*** 257,266 ****
--- 260,270 ----
// 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,429 ****
// 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) {
public Dimension getMaximumSize() {
return new Dimension(Short.MAX_VALUE, super.getPreferredSize().height);
}
};
fileNameLabel.setLabelFor(filenameTextField);
filenameTextField.addFocusListener(
new FocusAdapter() {
public void focusGained(FocusEvent e) {
--- 418,434 ----
// file entry and filters
JPanel fileAndFilterPanel = new JPanel();
fileAndFilterPanel.add(Box.createRigidArea(vstrut8));
fileAndFilterPanel.setLayout(new BoxLayout(fileAndFilterPanel, BoxLayout.Y_AXIS));
! @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,469 ****
getBottomPanel().add(Box.createRigidArea(new Dimension(30, 0)));
// buttons
getButtonPanel().setLayout(new BoxLayout(getButtonPanel(), BoxLayout.Y_AXIS));
! approveButton = new JButton(getApproveButtonText(fc)) {
public Dimension getMaximumSize() {
return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ?
approveButton.getPreferredSize() : cancelButton.getPreferredSize();
}
};
Insets buttonMargin = approveButton.getMargin();
buttonMargin = new InsetsUIResource(buttonMargin.top, buttonMargin.left + 5,
buttonMargin.bottom, buttonMargin.right + 5);
approveButton.setMargin(buttonMargin);
approveButton.setMnemonic(getApproveButtonMnemonic(fc));
--- 459,476 ----
getBottomPanel().add(Box.createRigidArea(new Dimension(30, 0)));
// buttons
getButtonPanel().setLayout(new BoxLayout(getButtonPanel(), BoxLayout.Y_AXIS));
! @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,486 ****
approveButton.setToolTipText(getApproveButtonToolTipText(fc));
getButtonPanel().add(Box.createRigidArea(vstrut6));
getButtonPanel().add(approveButton);
getButtonPanel().add(Box.createRigidArea(vstrut4));
! cancelButton = new JButton(cancelButtonText) {
public Dimension getMaximumSize() {
return approveButton.getPreferredSize().width > cancelButton.getPreferredSize().width ?
approveButton.getPreferredSize() : cancelButton.getPreferredSize();
}
};
cancelButton.setMargin(buttonMargin);
cancelButton.setToolTipText(cancelButtonToolTipText);
cancelButton.addActionListener(getCancelSelectionAction());
getButtonPanel().add(cancelButton);
--- 478,495 ----
approveButton.setToolTipText(getApproveButtonToolTipText(fc));
getButtonPanel().add(Box.createRigidArea(vstrut6));
getButtonPanel().add(approveButton);
getButtonPanel().add(Box.createRigidArea(vstrut4));
! @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,604 ****
--- 596,615 ----
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,924 ****
--- 926,936 ----
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,986 ****
--- 989,999 ----
}
//
// 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,1043 ****
--- 1047,1057 ----
}
/**
* 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,1175 ****
--- 1180,1190 ----
}
/**
* 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,1200 ****
--- 1206,1216 ----
}
/**
* 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();