FileDocCategorySizeDatePackage
MetalFileChooserUI.javaAPI DocJava SE 6 API39788Tue Jun 10 00:26:50 BST 2008javax.swing.plaf.metal

MetalFileChooserUI

public class MetalFileChooserUI extends BasicFileChooserUI
Metal L&F implementation of a FileChooser.
version
1.94 06/04/07
author
Jeff Dinkins

Fields Summary
private JLabel
lookInLabel
private JComboBox
directoryComboBox
private DirectoryComboBoxModel
directoryComboBoxModel
private Action
directoryComboBoxAction
private FilterComboBoxModel
filterComboBoxModel
private JTextField
fileNameTextField
private FilePane
filePane
private JToggleButton
listViewButton
private JToggleButton
detailsViewButton
private boolean
useShellFolder
private JButton
approveButton
private JButton
cancelButton
private JPanel
buttonPanel
private JPanel
bottomPanel
private JComboBox
filterComboBox
private static final Dimension
hstrut5
private static final Dimension
hstrut11
private static final Dimension
vstrut5
private static final Insets
shrinkwrap
private static int
PREF_WIDTH
private static int
PREF_HEIGHT
private static Dimension
PREF_SIZE
private static int
MIN_WIDTH
private static int
MIN_HEIGHT
private static Dimension
MIN_SIZE
private static int
LIST_PREF_WIDTH
private static int
LIST_PREF_HEIGHT
private static Dimension
LIST_PREF_SIZE
private int
lookInLabelMnemonic
private String
lookInLabelText
private String
saveInLabelText
private int
fileNameLabelMnemonic
private String
fileNameLabelText
private int
filesOfTypeLabelMnemonic
private String
filesOfTypeLabelText
private String
upFolderToolTipText
private String
upFolderAccessibleName
private String
homeFolderToolTipText
private String
homeFolderAccessibleName
private String
newFolderToolTipText
private String
newFolderAccessibleName
private String
listViewButtonToolTipText
private String
listViewButtonAccessibleName
private String
detailsViewButtonToolTipText
private String
detailsViewButtonAccessibleName
static final int
space
Constructors Summary
public MetalFileChooserUI(JFileChooser filechooser)

	super(filechooser);
    
Methods Summary
protected voidaddControlButtons()

	getBottomPanel().add(getButtonPanel());
    
protected javax.swing.ActionMapcreateActionMap()

        ActionMap map = new ActionMapUIResource();
	FilePane.addActionsToMap(map, filePane.getActions());
        return map;
    
protected javax.swing.JPanelcreateDetailsView(javax.swing.JFileChooser fc)

	return filePane.createDetailsView();
    
protected javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModelcreateDirectoryComboBoxModel(javax.swing.JFileChooser fc)

	return new DirectoryComboBoxModel();
    
protected javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxRenderercreateDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)

	return new DirectoryComboBoxRenderer();
    
protected javax.swing.plaf.metal.MetalFileChooserUI$FilterComboBoxModelcreateFilterComboBoxModel()

	return new FilterComboBoxModel();
    
protected javax.swing.plaf.metal.MetalFileChooserUI$FilterComboBoxRenderercreateFilterComboBoxRenderer()

	return new FilterComboBoxRenderer();
    
protected javax.swing.JPanelcreateList(javax.swing.JFileChooser fc)

	return filePane.createList();
    
public javax.swing.event.ListSelectionListenercreateListSelectionListener(javax.swing.JFileChooser fc)
Creates a selection listener for the list of files and directories.

param
fc a JFileChooser
return
a ListSelectionListener

	return super.createListSelectionListener(fc);
    
public java.beans.PropertyChangeListenercreatePropertyChangeListener(javax.swing.JFileChooser fc)

	return new PropertyChangeListener() {
	    public void propertyChange(PropertyChangeEvent e) {
		String s = e.getPropertyName();
		if(s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
		    doSelectedFileChanged(e);
		} else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
		    doSelectedFilesChanged(e);
		} else if(s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
		    doDirectoryChanged(e);
		} else if(s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
		    doFilterChanged(e);
		} else if(s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) {
		    doFileSelectionModeChanged(e);
		} else if(s.equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY)) {
		    doAccessoryChanged(e);
		} else if (s.equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY) ||
			   s.equals(JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) { 
		    doApproveButtonTextChanged(e);
		} else if(s.equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY)) {
		    doDialogTypeChanged(e);
		} else if(s.equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) {
		    doApproveButtonMnemonicChanged(e);
		} else if(s.equals(JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) {
		    doControlButtonsChanged(e);
		} else if (s.equals("componentOrientation")) {
		    ComponentOrientation o = (ComponentOrientation)e.getNewValue();
		    JFileChooser cc = (JFileChooser)e.getSource();
		    if (o != (ComponentOrientation)e.getOldValue()) {
			cc.applyComponentOrientation(o);
		    }
		} else if (s == "FileChooser.useShellFolder") {
		    updateUseShellFolder();
		    doDirectoryChanged(e);
		} else if (s.equals("ancestor")) {
		    if (e.getOldValue() == null && e.getNewValue() != null) {
			// Ancestor was added, set initial focus
			fileNameTextField.selectAll();
			fileNameTextField.requestFocus();
		    }
		}
	    }
	};
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)


    //
    // ComponentUI Interface Implementation methods
    //
         
        return new MetalFileChooserUI((JFileChooser) c);
    
private voiddoAccessoryChanged(java.beans.PropertyChangeEvent e)

	if(getAccessoryPanel() != null) {
	    if(e.getOldValue() != null) {
		getAccessoryPanel().remove((JComponent) e.getOldValue());
	    }
	    JComponent accessory = (JComponent) e.getNewValue();
	    if(accessory != null) {
		getAccessoryPanel().add(accessory, BorderLayout.CENTER);
	    }
	}
    
private voiddoApproveButtonMnemonicChanged(java.beans.PropertyChangeEvent e)

	// Note: Metal does not use mnemonics for approve and cancel
    
private voiddoApproveButtonTextChanged(java.beans.PropertyChangeEvent e)

	JFileChooser chooser = getFileChooser();
	approveButton.setText(getApproveButtonText(chooser));
	approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
    
private voiddoControlButtonsChanged(java.beans.PropertyChangeEvent e)

	if(getFileChooser().getControlButtonsAreShown()) {
	    addControlButtons();
	} else {
	    removeControlButtons();
	}
    
private voiddoDialogTypeChanged(java.beans.PropertyChangeEvent e)

	JFileChooser chooser = getFileChooser();
	approveButton.setText(getApproveButtonText(chooser));
	approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
	if (chooser.getDialogType() == JFileChooser.SAVE_DIALOG) {
	    lookInLabel.setText(saveInLabelText);
	} else {
	    lookInLabel.setText(lookInLabelText);
	}
    
private voiddoDirectoryChanged(java.beans.PropertyChangeEvent e)

	JFileChooser fc = getFileChooser();
	FileSystemView fsv = fc.getFileSystemView();

	clearIconCache();
	File currentDirectory = fc.getCurrentDirectory();
	if(currentDirectory != null) {
	    directoryComboBoxModel.addItem(currentDirectory);

	    if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
		if (fsv.isFileSystem(currentDirectory)) {
		    setFileName(currentDirectory.getPath());
		} else {
		    setFileName(null);
		}
	    }
	}
    
private voiddoFileSelectionModeChanged(java.beans.PropertyChangeEvent e)

	clearIconCache();

	JFileChooser fc = getFileChooser();
	File currentDirectory = fc.getCurrentDirectory();
	if (currentDirectory != null
	    && fc.isDirectorySelectionEnabled()
	    && !fc.isFileSelectionEnabled()
	    && fc.getFileSystemView().isFileSystem(currentDirectory)) {

	    setFileName(currentDirectory.getPath());
	} else {
	    setFileName(null);
	}
    
private voiddoFilterChanged(java.beans.PropertyChangeEvent e)

	clearIconCache();
    
private voiddoSelectedFileChanged(java.beans.PropertyChangeEvent e)

	File f = (File) e.getNewValue();
	JFileChooser fc = getFileChooser();
	if (f != null 
	    && ((fc.isFileSelectionEnabled() && !f.isDirectory())
		|| (f.isDirectory() && fc.isDirectorySelectionEnabled()))) {

	    setFileName(fileNameString(f));
	}
    
private voiddoSelectedFilesChanged(java.beans.PropertyChangeEvent e)

	File[] files = (File[]) e.getNewValue();
	JFileChooser fc = getFileChooser();
	if (files != null
	    && files.length > 0
	    && (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
	    setFileName(fileNameString(files));
	}
    
public voidensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)

	filePane.ensureFileIsVisible(fc, f);
    
private java.lang.StringfileNameString(java.io.File file)

	if (file == null) {
	    return null;
	} else {
	    JFileChooser fc = getFileChooser();
	    if ((fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) ||
	        (fc.isDirectorySelectionEnabled() && fc.isFileSelectionEnabled() && fc.getFileSystemView().isFileSystemRoot(file))) {
		return file.getPath();
	    } else {
		return file.getName();
	    }
	}
    
private java.lang.StringfileNameString(java.io.File[] files)

	StringBuffer buf = new StringBuffer();
	for (int i = 0; files != null && i < files.length; i++) {
	    if (i > 0) {
		buf.append(" ");
	    }
	    if (files.length > 1) {
		buf.append("\"");
	    }
	    buf.append(fileNameString(files[i]));
	    if (files.length > 1) {
		buf.append("\"");
	    }
	}
	return buf.toString();
    
protected javax.swing.ActionMapgetActionMap()

        return createActionMap();
    
protected javax.swing.JButtongetApproveButton(javax.swing.JFileChooser fc)

	return approveButton;
    
protected javax.swing.JPanelgetBottomPanel()

	if(bottomPanel == null) {
	    bottomPanel = new JPanel();
	}
	return bottomPanel;
    
protected javax.swing.JPanelgetButtonPanel()

	if (buttonPanel == null) {
	    buttonPanel = new JPanel();
	}
	return buttonPanel;
    
public java.lang.StringgetDirectoryName()

	// PENDING(jeff) - get the name from the directory combobox
	return null;
    
public java.lang.StringgetFileName()

	if (fileNameTextField != null) {
	    return fileNameTextField.getText();
	} else {
	    return null;
	}
    
public java.awt.DimensiongetMaximumSize(javax.swing.JComponent c)
Returns the maximum size of the JFileChooser.

param
c a JFileChooser
return
a Dimension specifying the maximum width and height of the file chooser

	return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    
public java.awt.DimensiongetMinimumSize(javax.swing.JComponent c)
Returns the minimum size of the JFileChooser.

param
c a JFileChooser
return
a Dimension specifying the minimum width and height of the file chooser

	return MIN_SIZE;
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)
Returns the preferred size of the specified JFileChooser. The preferred size is at least as large, in both height and width, as the preferred size recommended by the file chooser's layout manager.

param
c a JFileChooser
return
a Dimension specifying the preferred width and height of the file chooser

	int prefWidth = PREF_SIZE.width;
	Dimension d = c.getLayout().preferredLayoutSize(c);
	if (d != null) {
	    return new Dimension(d.width < prefWidth ? prefWidth : d.width,
				 d.height < PREF_SIZE.height ? PREF_SIZE.height : d.height);
	} else {
	    return new Dimension(prefWidth, PREF_SIZE.height);
	}
    
private static voidgroupLabels(javax.swing.plaf.metal.MetalFileChooserUI$AlignedLabel[] group)

	for (int i = 0; i < group.length; i++) {
	    group[i].group = group;
	}
    
public voidinstallComponents(javax.swing.JFileChooser fc)

	FileSystemView fsv = fc.getFileSystemView();

	fc.setBorder(new EmptyBorder(12, 12, 11, 11));
	fc.setLayout(new BorderLayout(0, 11));

	filePane = new FilePane(new MetalFileChooserUIAccessor());
	fc.addPropertyChangeListener(filePane);

	updateUseShellFolder();

	// ********************************* //
	// **** Construct the top panel **** //
	// ********************************* //

	// Directory manipulation buttons
	JPanel topPanel = new JPanel(new BorderLayout(11, 0));
	JPanel topButtonPanel = new JPanel();
	topButtonPanel.setLayout(new BoxLayout(topButtonPanel, BoxLayout.LINE_AXIS));
	topPanel.add(topButtonPanel, BorderLayout.AFTER_LINE_ENDS);

	// Add the top panel to the fileChooser
	fc.add(topPanel, BorderLayout.NORTH);

	// ComboBox Label
     	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);
	directoryComboBox.setModel(directoryComboBoxModel);
	directoryComboBox.addActionListener(directoryComboBoxAction);
	directoryComboBox.setRenderer(createDirectoryComboBoxRenderer(fc));
	directoryComboBox.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	directoryComboBox.setAlignmentY(JComponent.TOP_ALIGNMENT);
	directoryComboBox.setMaximumRowCount(8);

	topPanel.add(directoryComboBox, BorderLayout.CENTER);

	// Up Button
	JButton upFolderButton = new JButton(getChangeToParentDirectoryAction());
	upFolderButton.setText(null);
	upFolderButton.setIcon(upFolderIcon);
        upFolderButton.setToolTipText(upFolderToolTipText);
        upFolderButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
                                         upFolderAccessibleName);
	upFolderButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	upFolderButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
	upFolderButton.setMargin(shrinkwrap);

	topButtonPanel.add(upFolderButton);
	topButtonPanel.add(Box.createRigidArea(hstrut5));

	// Home Button
	File homeDir = fsv.getHomeDirectory();
	String toolTipText = homeFolderToolTipText;
	if (fsv.isRoot(homeDir)) {
	    toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
	}




	JButton b = new JButton(homeFolderIcon);
     	b.setToolTipText(toolTipText);
        b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
                            homeFolderAccessibleName);
	b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
	b.setMargin(shrinkwrap);

	b.addActionListener(getGoHomeAction());
	topButtonPanel.add(b);
	topButtonPanel.add(Box.createRigidArea(hstrut5));

	// New Directory Button
	if (!UIManager.getBoolean("FileChooser.readOnly")) {
	    b = new JButton(filePane.getNewFolderAction());
	    b.setText(null);
	    b.setIcon(newFolderIcon);
	    b.setToolTipText(newFolderToolTipText);
            b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
                                newFolderAccessibleName);
	    b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	    b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
	    b.setMargin(shrinkwrap);
	}
	topButtonPanel.add(b);
	topButtonPanel.add(Box.createRigidArea(hstrut5));

	// View button group
	ButtonGroup viewButtonGroup = new ButtonGroup();

	// List Button
	listViewButton = new JToggleButton(listViewIcon);
     	listViewButton.setToolTipText(listViewButtonToolTipText);
        listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
                                         listViewButtonAccessibleName);
	listViewButton.setSelected(true);
	listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
	listViewButton.setMargin(shrinkwrap);
	listViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_LIST));
	topButtonPanel.add(listViewButton);
	viewButtonGroup.add(listViewButton);

	// Details Button
	detailsViewButton = new JToggleButton(detailsViewIcon);
     	detailsViewButton.setToolTipText(detailsViewButtonToolTipText);
        detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
                                            detailsViewButtonAccessibleName);
	detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
	detailsViewButton.setMargin(shrinkwrap);
	detailsViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_DETAILS));
	topButtonPanel.add(detailsViewButton);
	viewButtonGroup.add(detailsViewButton);

	filePane.addPropertyChangeListener(new PropertyChangeListener() {
	    public void propertyChange(PropertyChangeEvent e) {
		if ("viewType".equals(e.getPropertyName())) {
		    int viewType = filePane.getViewType();
		    switch (viewType) {
		      case FilePane.VIEWTYPE_LIST:
			listViewButton.setSelected(true);
			break;

		      case FilePane.VIEWTYPE_DETAILS:
			detailsViewButton.setSelected(true);
			break;
		    }
		}
	    }
	});

	// ************************************** //
	// ******* Add the directory pane ******* //
	// ************************************** //
	fc.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS);
	JComponent accessory = fc.getAccessory();
	if(accessory != null) {
	    getAccessoryPanel().add(accessory);
	}
	filePane.setPreferredSize(LIST_PREF_SIZE);
	fc.add(filePane, BorderLayout.CENTER);

	// ********************************** //
	// **** Construct the bottom panel ** //
	// ********************************** //
	JPanel bottomPanel = getBottomPanel();
	bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.Y_AXIS));
	fc.add(bottomPanel, BorderLayout.SOUTH);

	// FileName label and textfield
	JPanel fileNamePanel = new JPanel();
	fileNamePanel.setLayout(new BoxLayout(fileNamePanel, BoxLayout.LINE_AXIS));
	bottomPanel.add(fileNamePanel);
	bottomPanel.add(Box.createRigidArea(vstrut5));

     	AlignedLabel fileNameLabel = new AlignedLabel(fileNameLabelText);
     	fileNameLabel.setDisplayedMnemonic(fileNameLabelMnemonic);
	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) {
		    if (!getFileChooser().isMultiSelectionEnabled()) {
			filePane.clearSelection();
		    }
		}
	    }
        );
	if (fc.isMultiSelectionEnabled()) {
	    setFileName(fileNameString(fc.getSelectedFiles()));
	} else {
	    setFileName(fileNameString(fc.getSelectedFile()));
	}


	// Filetype label and combobox
	JPanel filesOfTypePanel = new JPanel();
	filesOfTypePanel.setLayout(new BoxLayout(filesOfTypePanel, BoxLayout.LINE_AXIS));
	bottomPanel.add(filesOfTypePanel);

     	AlignedLabel filesOfTypeLabel = new AlignedLabel(filesOfTypeLabelText);
     	filesOfTypeLabel.setDisplayedMnemonic(filesOfTypeLabelMnemonic);
	filesOfTypePanel.add(filesOfTypeLabel);

	filterComboBoxModel = createFilterComboBoxModel();
	fc.addPropertyChangeListener(filterComboBoxModel);
	filterComboBox = new JComboBox(filterComboBoxModel);
        filterComboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
                                         filesOfTypeLabelText);
	filesOfTypeLabel.setLabelFor(filterComboBox);
	filterComboBox.setRenderer(createFilterComboBoxRenderer());
	filesOfTypePanel.add(filterComboBox);

	// buttons
	getButtonPanel().setLayout(new ButtonAreaLayout());

	approveButton = new JButton(getApproveButtonText(fc));
	// Note: Metal does not use mnemonics for approve and cancel
	approveButton.addActionListener(getApproveSelectionAction());
	approveButton.setToolTipText(getApproveButtonToolTipText(fc));
	getButtonPanel().add(approveButton);

	cancelButton = new JButton(cancelButtonText);
	cancelButton.setToolTipText(cancelButtonToolTipText);
	cancelButton.addActionListener(getCancelSelectionAction());
	getButtonPanel().add(cancelButton);

	if(fc.getControlButtonsAreShown()) {
	    addControlButtons();
	}

	groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel });
    
protected voidinstallListeners(javax.swing.JFileChooser fc)

	super.installListeners(fc);
        ActionMap actionMap = getActionMap();
        SwingUtilities.replaceUIActionMap(fc, actionMap);
    
protected voidinstallStrings(javax.swing.JFileChooser fc)

	super.installStrings(fc);

        Locale l = fc.getLocale();

	lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic"); 
	lookInLabelText = UIManager.getString("FileChooser.lookInLabelText",l);
	saveInLabelText = UIManager.getString("FileChooser.saveInLabelText",l);
	
	fileNameLabelMnemonic = UIManager.getInt("FileChooser.fileNameLabelMnemonic");  
	fileNameLabelText = UIManager.getString("FileChooser.fileNameLabelText",l); 
	
	filesOfTypeLabelMnemonic = UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic");  
	filesOfTypeLabelText = UIManager.getString("FileChooser.filesOfTypeLabelText",l); 
	
	upFolderToolTipText =  UIManager.getString("FileChooser.upFolderToolTipText",l);
	upFolderAccessibleName = UIManager.getString("FileChooser.upFolderAccessibleName",l); 
	
	homeFolderToolTipText =  UIManager.getString("FileChooser.homeFolderToolTipText",l);
	homeFolderAccessibleName = UIManager.getString("FileChooser.homeFolderAccessibleName",l); 
	
	newFolderToolTipText = UIManager.getString("FileChooser.newFolderToolTipText",l);
	newFolderAccessibleName = UIManager.getString("FileChooser.newFolderAccessibleName",l); 
	
	listViewButtonToolTipText = UIManager.getString("FileChooser.listViewButtonToolTipText",l); 
	listViewButtonAccessibleName = UIManager.getString("FileChooser.listViewButtonAccessibleName",l); 
	
	detailsViewButtonToolTipText = UIManager.getString("FileChooser.detailsViewButtonToolTipText",l); 
	detailsViewButtonAccessibleName = UIManager.getString("FileChooser.detailsViewButtonAccessibleName",l); 
    
public voidinstallUI(javax.swing.JComponent c)

	super.installUI(c);
    
protected voidremoveControlButtons()

	getBottomPanel().remove(getButtonPanel());
    
public voidrescanCurrentDirectory(javax.swing.JFileChooser fc)

	filePane.rescanCurrentDirectory();
    
public voidsetDirectoryName(java.lang.String dirname)

	// PENDING(jeff) - set the name in the directory combobox
    
protected voidsetDirectorySelected(boolean directorySelected)
Property to remember whether a directory is currently selected in the UI. This is normally called by the UI on a selection event.

param
directorySelected if a directory is currently selected.
since
1.4

	super.setDirectorySelected(directorySelected);
	JFileChooser chooser = getFileChooser();
	if(directorySelected) {
            if (approveButton != null) {
	        approveButton.setText(directoryOpenButtonText);
	        approveButton.setToolTipText(directoryOpenButtonToolTipText);
            }
	} else {
            if (approveButton != null) {
                approveButton.setText(getApproveButtonText(chooser));
                approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
            }
	}
    
public voidsetFileName(java.lang.String filename)

	if (fileNameTextField != null) {
	    fileNameTextField.setText(filename);
	}
    
public voiduninstallComponents(javax.swing.JFileChooser fc)

	fc.removeAll();
	bottomPanel = null;
	buttonPanel = null;
    
public voiduninstallUI(javax.swing.JComponent c)

	// Remove listeners
	c.removePropertyChangeListener(filterComboBoxModel);
	c.removePropertyChangeListener(filePane);
	cancelButton.removeActionListener(getCancelSelectionAction());
	approveButton.removeActionListener(getApproveSelectionAction());
	fileNameTextField.removeActionListener(getApproveSelectionAction());

	if (filePane != null) {
	    filePane.uninstallUI();
	    filePane = null;
	}

	super.uninstallUI(c);
    
private voidupdateUseShellFolder()

	// Decide whether to use the ShellFolder class to populate shortcut
	// panel and combobox.
	JFileChooser fc = getFileChooser();
	Boolean prop =
	    (Boolean)fc.getClientProperty("FileChooser.useShellFolder");
	if (prop != null) {
	    useShellFolder = prop.booleanValue();
	} else {
	    // See if FileSystemView.getRoots() returns the desktop folder,
	    // i.e. the normal Windows hierarchy.
	    useShellFolder = false;
	    File[] roots = fc.getFileSystemView().getRoots();
	    if (roots != null && roots.length == 1) {
		File[] cbFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders");
		if (cbFolders != null && cbFolders.length > 0 && roots[0] == cbFolders[0]) {
		    useShellFolder = true;
		}
	    }
	}
    
public voidvalueChanged(javax.swing.event.ListSelectionEvent e)

	JFileChooser fc = getFileChooser();
	File f = fc.getSelectedFile();
	if (!e.getValueIsAdjusting() && f != null && !getFileChooser().isTraversable(f)) {
	    setFileName(fileNameString(f));
	}