-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
generic
-
generic
Name: stC104175 Date: 04/13/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
"Look In" label text is used for both opening a file or saving a file.
The "Look in" label is confusing to users when saving a file.
Propose that the label be changed to "Save In" for save dialogs.
As a workaround, I tried setting the FileChooser.lookInLabelText
value, then update the UI, but aside from being inefficient, it
doesn't work. The combobox model for the dropdown gets recreated
and set to the 0th element. As a result, the file view shows the files
of the current directory, but the combobox is out of sync with the
current directory.
fileChooser = new JFileChooser(System.getProperty("user.home")) {
/**
* override default to use "Save In" vs. "Look In" when saving
*/
public int showSaveDialog(Component parent) {
UIManager.put("FileChooser.lookInLabelText", "Save In");
SwingUtilities.updateComponentTreeUI(this);
return super.showOpenDialog(parent);
}
/**
* switch back to appropriate label
*/
public int showOpenDialog(Component parent) {
UIManager.put("FileChooser.lookInLabelText", "Look In");
SwingUtilities.updateComponentTreeUI(this);
return super.showOpenDialog(parent);
}
};
public class MetalFileChooserUI extends BasicFileChooserUI {
...
public void installComponents(JFileChooser fc) {
...
// CurrentDir ComboBox
directoryComboBox = new JComboBox();
directoryComboBox.putClientProperty(
"JComboBox.lightweightKeyboardNavigation", "Lightweight" );
l.setLabelFor(directoryComboBox);
directoryComboBoxModel = createDirectoryComboBoxModel(fc);
directoryComboBox.setModel(directoryComboBoxModel);
directoryComboBox.addActionListener(directoryComboBoxAction);
directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc));
directoryComboBox.setAlignmentX(JComponent.LEFT_ALIGNMENT);
directoryComboBox.setAlignmentY(JComponent.CENTER_ALIGNMENT);
topPanel.add(directoryComboBox);
topPanel.add(Box.createRigidArea(hstrut10));
...
}
(Review ID: 102339)
======================================================================