FileDocCategorySizeDatePackage
GTKFileChooserUI.javaAPI DocJava SE 6 API46976Tue Jun 10 00:21:54 BST 2008com.sun.java.swing.plaf.gtk

GTKFileChooserUI

public class GTKFileChooserUI extends SynthFileChooserUI
GTK FileChooserUI.
version
1.36 08/21/02
author
Leif Samuelsson
author
Jeff Dinkins

Fields Summary
private JPanel
accessoryPanel
private String
newFolderButtonText
private String
newFolderErrorSeparator
private String
newFolderErrorText
private String
newFolderDialogText
private String
deleteFileButtonText
private String
renameFileButtonText
private String
newFolderButtonToolTipText
private String
deleteFileButtonToolTipText
private String
renameFileButtonToolTipText
private int
newFolderButtonMnemonic
private int
deleteFileButtonMnemonic
private int
renameFileButtonMnemonic
private int
foldersLabelMnemonic
private int
filesLabelMnemonic
private String
renameFileDialogText
private String
renameFileErrorTitle
private String
renameFileErrorText
private JComboBox
filterComboBox
private FilterComboBoxModel
filterComboBoxModel
private JPanel
rightPanel
private JList
directoryList
private JList
fileList
private JLabel
pathField
private JTextField
fileNameTextField
private static final Dimension
hstrut3
private static final Dimension
vstrut10
private static final Insets
insets
private static Dimension
prefListSize
private static Dimension
PREF_SIZE
private static Dimension
MIN_SIZE
private static Dimension
PREF_ACC_SIZE
private static Dimension
ZERO_ACC_SIZE
private static Dimension
MAX_SIZE
private static final Insets
buttonMargin
private String
filesLabelText
private String
foldersLabelText
private String
pathLabelText
private String
filterLabelText
private int
pathLabelMnemonic
private int
filterLabelMnemonic
private JComboBox
directoryComboBox
private DirectoryComboBoxModel
directoryComboBoxModel
private Action
directoryComboBoxAction
private JPanel
bottomButtonPanel
private GTKDirectoryModel
model
private Action
newFolderAction
private JPanel
interior
private boolean
readOnly
private boolean
showDirectoryIcons
private boolean
showFileIcons
private GTKFileView
fileView
private PropertyChangeListener
gtkFCPropertyChangeListener
private Action
approveSelectionAction
private GTKDirectoryListModel
directoryListModel
Constructors Summary
public GTKFileChooserUI(JFileChooser filechooser)


       
        super(filechooser);
    
Methods Summary
protected voidalign(javax.swing.JComponent c)

	c.setAlignmentX(JComponent.LEFT_ALIGNMENT);
	c.setAlignmentY(JComponent.TOP_ALIGNMENT);
    
protected com.sun.java.swing.plaf.gtk.GTKFileChooserUI$DirectoryComboBoxModelcreateDirectoryComboBoxModel(javax.swing.JFileChooser fc)

	return new DirectoryComboBoxModel();
    
protected javax.swing.JScrollPanecreateDirectoryList()

	directoryList = new JList();
	directoryList.setName("GTKFileChooser.directoryList");
	directoryList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, foldersLabelText);
	align(directoryList);

	directoryList.setCellRenderer(new DirectoryCellRenderer());
        directoryListModel = new GTKDirectoryListModel();
        directoryList.getSelectionModel().removeSelectionInterval(0, 0);
	directoryList.setModel(directoryListModel);
	directoryList.addMouseListener(createDoubleClickListener(getFileChooser(), directoryList));
	directoryList.addListSelectionListener(createListSelectionListener(getFileChooser()));

	JScrollPane scrollpane = new JScrollPane(directoryList);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);    
	scrollpane.setName("GTKFileChooser.directoryListScrollPane");
	scrollpane.setMaximumSize(MAX_SIZE);
	scrollpane.setPreferredSize(prefListSize);
	align(scrollpane);
	return scrollpane;
    
protected java.awt.event.MouseListenercreateDoubleClickListener(javax.swing.JFileChooser fc, javax.swing.JList list)

	return new DoubleClickListener(list);
    
protected javax.swing.JScrollPanecreateFilesList()

	fileList = new JList();
	fileList.setName("GTKFileChooser.fileList");
	fileList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, filesLabelText);

	if (getFileChooser().isMultiSelectionEnabled()) {
	    fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
	} else {
	    fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	}
	
	fileList.setModel(new GTKFileListModel());
        fileList.getSelectionModel().removeSelectionInterval(0, 0);
	fileList.setCellRenderer(new FileCellRenderer());
	fileList.addListSelectionListener(createListSelectionListener(getFileChooser()));
	fileList.addMouseListener(createDoubleClickListener(getFileChooser(), fileList));
	align(fileList);
	JScrollPane scrollpane = new JScrollPane(fileList);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	scrollpane.setName("GTKFileChooser.fileListScrollPane");
	scrollpane.setPreferredSize(prefListSize);
	scrollpane.setMaximumSize(MAX_SIZE);
	align(scrollpane);
	return scrollpane;
    
protected com.sun.java.swing.plaf.gtk.GTKFileChooserUI$FilterComboBoxModelcreateFilterComboBoxModel()

        return new FilterComboBoxModel();
    
protected com.sun.java.swing.plaf.gtk.GTKFileChooserUI$FilterComboBoxRenderercreateFilterComboBoxRenderer()

        return new FilterComboBoxRenderer();
    
public javax.swing.event.ListSelectionListenercreateListSelectionListener(javax.swing.JFileChooser fc)

	return new SelectionListener();
    
protected voidcreateModel()

        model = new GTKDirectoryModel();
    
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)

        return new GTKFileChooserUI((JFileChooser)c);
    
protected 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);
		getAccessoryPanel().setPreferredSize(accessory.getPreferredSize());
		getAccessoryPanel().setMaximumSize(MAX_SIZE);
	    } else {
		getAccessoryPanel().setPreferredSize(ZERO_ACC_SIZE);
		getAccessoryPanel().setMaximumSize(ZERO_ACC_SIZE);
	    }
	}
    
protected voiddoAncestorChanged(java.beans.PropertyChangeEvent e)

	if (e.getOldValue() == null && e.getNewValue() != null) {
	    // Ancestor was added, set initial focus
	    fileNameTextField.selectAll();
	    fileNameTextField.requestFocus();
	    updateDefaultButton();
	}

	super.doAncestorChanged(e);
    
protected voiddoControlButtonsChanged(java.beans.PropertyChangeEvent e)

	super.doControlButtonsChanged(e);

	JFileChooser filechooser = getFileChooser();
	if (filechooser.getControlButtonsAreShown()) {
	    filechooser.add(bottomButtonPanel, BorderLayout.SOUTH);
	} else {
	    filechooser.remove(bottomButtonPanel);
	}
	updateDefaultButton();
    
protected voiddoDirectoryChanged(java.beans.PropertyChangeEvent e)

	directoryList.clearSelection();
	ListSelectionModel sm = directoryList.getSelectionModel();
        if (sm instanceof DefaultListSelectionModel) {
	    ((DefaultListSelectionModel)sm).moveLeadSelectionIndex(0);       
	    ((DefaultListSelectionModel)sm).setAnchorSelectionIndex(0);
	}
	fileList.clearSelection();
	sm = fileList.getSelectionModel();
        if (sm instanceof DefaultListSelectionModel) {
	    ((DefaultListSelectionModel)sm).moveLeadSelectionIndex(0);       
	    ((DefaultListSelectionModel)sm).setAnchorSelectionIndex(0);
	}

	File currentDirectory = getFileChooser().getCurrentDirectory();
	if (currentDirectory != null) {
	    try {
		setDirectoryName(ShellFolder.getNormalizedFile((File)e.getNewValue()).getPath());
	    } catch (IOException ioe) {
		setDirectoryName(((File)e.getNewValue()).getAbsolutePath());
	    }
	    if ((getFileChooser().getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY) && !getFileChooser().isMultiSelectionEnabled()) {
		setFileName(pathField.getText());
	    }
	    directoryComboBoxModel.addItem(currentDirectory);
            directoryListModel.directoryChanged();
	}
	super.doDirectoryChanged(e);
    
protected voiddoFileSelectionModeChanged(java.beans.PropertyChangeEvent e)

	directoryList.clearSelection();
	rightPanel.setVisible(((Integer)e.getNewValue()).intValue() != JFileChooser.DIRECTORIES_ONLY);

	super.doFileSelectionModeChanged(e);
    
protected voiddoMultiSelectionChanged(java.beans.PropertyChangeEvent e)

	if (getFileChooser().isMultiSelectionEnabled()) {
	    fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
	} else {
	    fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	    fileList.clearSelection();
	}

	super.doMultiSelectionChanged(e);
    
protected voiddoSelectedFileChanged(java.beans.PropertyChangeEvent e)

	super.doSelectedFileChanged(e);
	File f = (File) e.getNewValue();
	if (f != null) {
	    setFileName(getFileChooser().getName(f));
	}
    
public voidensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)

	// PENDING
    
public javax.swing.JPanelgetAccessoryPanel()

	return accessoryPanel;
    
public javax.swing.ActiongetApproveSelectionAction()

        return approveSelectionAction;
    
public java.lang.StringgetFileName()

        JFileChooser fc = getFileChooser();
        String typedInName = fileNameTextField != null ?
            fileNameTextField.getText() : null;
         
        if (!fc.isMultiSelectionEnabled()) {
            return typedInName; 
        }
         
        int mode = fc.getFileSelectionMode();
        JList list = mode == JFileChooser.DIRECTORIES_ONLY ?
            directoryList : fileList;
        Object[] files = list.getSelectedValues();
        int len = files.length;
        Vector result = new Vector(len + 1);
         
        // we return all selected file names
        for (int i = 0; i < len; i++) {
            File file = (File)files[i];
            result.add(file.getName());
        }
        // plus the file name typed into the text field, if not already there
        if (typedInName != null && !result.contains(typedInName)) {
            result.add(typedInName);
        }
         
        StringBuffer buf = new StringBuffer();
        len = result.size();
         
        // construct the resulting string
        for (int i=0; i<len; i++) {
            if (len > 1) {
                buf.append(" \"");
            }
            buf.append(result.get(i));
            if (len > 1) {
                buf.append("\"");
            }
        }
        return buf.toString();
    
public javax.swing.filechooser.FileViewgetFileView(javax.swing.JFileChooser fc)

	return fileView;
    
public java.awt.DimensiongetMaximumSize(javax.swing.JComponent x)

	return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    
public java.awt.DimensiongetMinimumSize(javax.swing.JComponent x)

	return new Dimension(MIN_SIZE);
    
private intgetMnemonic(java.lang.String key, java.util.Locale l)

        return SwingUtilities2.getUIDefaultsInt(key, l);
    
public javax.swing.plaf.basic.BasicDirectoryModelgetModel()

        return model;
    
public javax.swing.ActiongetNewFolderAction()

        if (newFolderAction == null) {
            newFolderAction = new NewFolderAction();
            newFolderAction.setEnabled(!readOnly);
        }
        return newFolderAction;
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)

	Dimension prefSize = new Dimension(PREF_SIZE);
	JComponent accessory = getFileChooser().getAccessory();
	if (accessory != null) {
	    prefSize.width += accessory.getPreferredSize().width + 20;
	}
	Dimension d = c.getLayout().preferredLayoutSize(c);
	if (d != null) {
	    return new Dimension(d.width < prefSize.width ? prefSize.width : d.width,
				 d.height < prefSize.height ? prefSize.height : d.height);
	} else {
	    return prefSize;
	}
    
public voidinstallComponents(javax.swing.JFileChooser fc)

	super.installComponents(fc);

	boolean leftToRight = fc.getComponentOrientation().isLeftToRight();

	fc.setLayout(new BorderLayout());
	fc.setAlignmentX(JComponent.CENTER_ALIGNMENT);

	// Top row of buttons
	JPanel topButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
        topButtonPanel.setBorder(new EmptyBorder(10, 10, 0, 10));
	topButtonPanel.setName("GTKFileChooser.topButtonPanel");

	if (!UIManager.getBoolean("FileChooser.readOnly")) {
	    JButton newFolderButton = new JButton(getNewFolderAction());
	    newFolderButton.setName("GTKFileChooser.newFolderButton");
	    newFolderButton.setMnemonic(newFolderButtonMnemonic);
	    newFolderButton.setToolTipText(newFolderButtonToolTipText);
	    newFolderButton.setText(newFolderButtonText);
	    topButtonPanel.add(newFolderButton);
	}
	JButton deleteFileButton = new JButton(deleteFileButtonText);
	deleteFileButton.setName("GTKFileChooser.deleteFileButton");
	deleteFileButton.setMnemonic(deleteFileButtonMnemonic);
	deleteFileButton.setToolTipText(deleteFileButtonToolTipText);
	deleteFileButton.setEnabled(false);
	topButtonPanel.add(deleteFileButton);

        RenameFileAction rfa = new RenameFileAction();
        JButton renameFileButton = new JButton(rfa);
        if (readOnly) {
            rfa.setEnabled(false);
        }
        renameFileButton.setText(renameFileButtonText); 
	renameFileButton.setName("GTKFileChooser.renameFileButton");
	renameFileButton.setMnemonic(renameFileButtonMnemonic);
	renameFileButton.setToolTipText(renameFileButtonToolTipText);
	topButtonPanel.add(renameFileButton);

	fc.add(topButtonPanel, BorderLayout.NORTH);


	JPanel interior = new JPanel();
        interior.setBorder(new EmptyBorder(0, 10, 10, 10));
	interior.setName("GTKFileChooser.interiorPanel");
	align(interior);
	interior.setLayout(new BoxLayout(interior, BoxLayout.PAGE_AXIS));

	fc.add(interior, BorderLayout.CENTER);

	JPanel comboBoxPanel = new JPanel(new FlowLayout(FlowLayout.CENTER,
                                                         0, 0) {
            public void layoutContainer(Container target) {
                super.layoutContainer(target);
                JComboBox comboBox = directoryComboBox;
                if (comboBox.getWidth() > target.getWidth()) {
                    comboBox.setBounds(0, comboBox.getY(), target.getWidth(),
                                       comboBox.getHeight());
                }
            }
        });
        comboBoxPanel.setBorder(new EmptyBorder(0, 0, 4, 0));
	comboBoxPanel.setName("GTKFileChooser.directoryComboBoxPanel");
	// CurrentDir ComboBox
	directoryComboBoxModel = createDirectoryComboBoxModel(fc);
	directoryComboBox = new JComboBox(directoryComboBoxModel);
	directoryComboBox.setName("GTKFileChooser.directoryComboBox");
	directoryComboBox.putClientProperty( "JComboBox.lightweightKeyboardNavigation", "Lightweight" );
	directoryComboBox.addActionListener(directoryComboBoxAction);
	directoryComboBox.setMaximumRowCount(8);
	comboBoxPanel.add(directoryComboBox);
	interior.add(comboBoxPanel);


	// CENTER: left, right, accessory
	JPanel centerPanel = new JPanel(new BorderLayout());
	centerPanel.setName("GTKFileChooser.centerPanel");

	// SPLIT PANEL: left, right
	JSplitPane splitPanel = new JSplitPane();
	splitPanel.setName("GTKFileChooser.splitPanel");
	splitPanel.setDividerLocation((PREF_SIZE.width-8)/2);

	// left panel - Filter & directoryList
	JPanel leftPanel = new JPanel(new GridBagLayout());
	leftPanel.setName("GTKFileChooser.directoryListPanel");

	// Add the Directory List
	// Create a label that looks like button (should be a table header)
	TableCellRenderer headerRenderer = new JTableHeader().getDefaultRenderer();
	JLabel directoryListLabel =
	    (JLabel)headerRenderer.getTableCellRendererComponent(null, foldersLabelText,
								     false, false, 0, 0);
	directoryListLabel.setName("GTKFileChooser.directoryListLabel");
	leftPanel.add(directoryListLabel, new GridBagConstraints(
                          0, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
                          GridBagConstraints.HORIZONTAL,
                          new Insets(0, 0, 0, 0), 0, 0));
	leftPanel.add(createDirectoryList(), new GridBagConstraints(
                          0, 1, 1, 1, 1, 1, GridBagConstraints.EAST,
                          GridBagConstraints.BOTH,
                          new Insets(0, 0, 0, 0), 0, 0));
        directoryListLabel.setDisplayedMnemonic(foldersLabelMnemonic);
        directoryListLabel.setLabelFor(directoryList);

	// create files list
	rightPanel = new JPanel(new GridBagLayout());
	rightPanel.setName("GTKFileChooser.fileListPanel");

	headerRenderer = new JTableHeader().getDefaultRenderer();
	JLabel fileListLabel = 
	    (JLabel)headerRenderer.getTableCellRendererComponent(null, filesLabelText,
								     false, false, 0, 0);
	fileListLabel.setName("GTKFileChooser.fileListLabel");        
	rightPanel.add(fileListLabel, new GridBagConstraints(
                          0, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
                          GridBagConstraints.HORIZONTAL,
                          new Insets(0, 0, 0, 0), 0, 0));
	rightPanel.add(createFilesList(), new GridBagConstraints(
                          0, 1, 1, 1, 1, 1, GridBagConstraints.EAST,
                          GridBagConstraints.BOTH,
                          new Insets(0, 0, 0, 0), 0, 0));
        fileListLabel.setDisplayedMnemonic(filesLabelMnemonic);
        fileListLabel.setLabelFor(fileList);

	splitPanel.add(leftPanel,  leftToRight ? JSplitPane.LEFT : JSplitPane.RIGHT);
	splitPanel.add(rightPanel, leftToRight ? JSplitPane.RIGHT : JSplitPane.LEFT);
	centerPanel.add(splitPanel, BorderLayout.CENTER);

	JComponent accessoryPanel = getAccessoryPanel();
	JComponent accessory = fc.getAccessory();
	if (accessoryPanel != null) {
	    if (accessory == null) {
		accessoryPanel.setPreferredSize(ZERO_ACC_SIZE);
		accessoryPanel.setMaximumSize(ZERO_ACC_SIZE);
	    } else {
		getAccessoryPanel().add(accessory, BorderLayout.CENTER);
		accessoryPanel.setPreferredSize(accessory.getPreferredSize());
		accessoryPanel.setMaximumSize(MAX_SIZE);
	    }
	    align(accessoryPanel);
	    centerPanel.add(accessoryPanel, BorderLayout.AFTER_LINE_ENDS);
	}
	interior.add(centerPanel);
	interior.add(Box.createRigidArea(vstrut10));

	JPanel pathFieldPanel = new JPanel(new FlowLayout(FlowLayout.LEADING,
                                                          0, 0));
        pathFieldPanel.setBorder(new EmptyBorder(0, 0, 4, 0));
	JLabel pathFieldLabel = new JLabel(pathLabelText);
	pathFieldLabel.setName("GTKFileChooser.pathFieldLabel");
	pathFieldLabel.setDisplayedMnemonic(pathLabelMnemonic);
	align(pathFieldLabel);
	pathFieldPanel.add(pathFieldLabel);
        pathFieldPanel.add(Box.createRigidArea(hstrut3));

	File currentDirectory = fc.getCurrentDirectory();
	String curDirName = null;
	if (currentDirectory != null) {
	    curDirName = currentDirectory.getPath();
	}
	pathField = new JLabel(curDirName) {
	    public Dimension getMaximumSize() {
		Dimension d = super.getMaximumSize();
		d.height = getPreferredSize().height;
		return d;
	    }
	};
	pathField.setName("GTKFileChooser.pathField");
	align(pathField);
	pathFieldPanel.add(pathField);
	interior.add(pathFieldPanel);

	// add the fileName field
	fileNameTextField = new JTextField() {
	    public Dimension getMaximumSize() {
		Dimension d = super.getMaximumSize();
		d.height = getPreferredSize().height;
		return d;
	    }
	};
        
        pathFieldLabel.setLabelFor(fileNameTextField);
        
        Set forwardTraversalKeys = fileNameTextField.getFocusTraversalKeys(
            KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
        forwardTraversalKeys = new HashSet(forwardTraversalKeys);
        forwardTraversalKeys.remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
        fileNameTextField.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardTraversalKeys);

	fileNameTextField.setName("GTKFileChooser.fileNameTextField");
	fileNameTextField.getActionMap().put("fileNameCompletionAction", getFileNameCompletionAction());
        fileNameTextField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "fileNameCompletionAction");
	interior.add(fileNameTextField);

        // Add the filter combo box
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
        panel.setBorder(new EmptyBorder(0, 0, 4, 0));
        JLabel filterLabel = new JLabel(filterLabelText);
        filterLabel.setName("GTKFileChooser.filterLabel");
        filterLabel.setDisplayedMnemonic(filterLabelMnemonic);
        panel.add(filterLabel);

        filterComboBoxModel = createFilterComboBoxModel();
        fc.addPropertyChangeListener(filterComboBoxModel);
        filterComboBox = new JComboBox(filterComboBoxModel);
        filterComboBox.setRenderer(createFilterComboBoxRenderer());
        filterLabel.setLabelFor(filterComboBox);

        interior.add(Box.createRigidArea(vstrut10));
        interior.add(panel);
        interior.add(filterComboBox);

        // Add buttons
        bottomButtonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
        bottomButtonPanel.setName("GTKFileChooser.bottomButtonPanel");
        align(bottomButtonPanel);

        JButton cancelButton = getCancelButton(fc);
        align(cancelButton);
        cancelButton.setMargin(buttonMargin);
        bottomButtonPanel.add(cancelButton);

        JButton approveButton = getApproveButton(fc);;
        align(approveButton);
        approveButton.setMargin(buttonMargin);
        bottomButtonPanel.add(approveButton);

        if (fc.getControlButtonsAreShown()) {
            fc.add(bottomButtonPanel, BorderLayout.SOUTH);
        }
    
protected voidinstallDefaults(javax.swing.JFileChooser fc)

	super.installDefaults(fc);
	readOnly = UIManager.getBoolean("FileChooser.readOnly");
	showDirectoryIcons =
	    Boolean.TRUE.equals(fc.getClientProperty("GTKFileChooser.showDirectoryIcons"));
	showFileIcons =
	    Boolean.TRUE.equals(fc.getClientProperty("GTKFileChooser.showFileIcons"));
    
protected voidinstallIcons(javax.swing.JFileChooser fc)

	directoryIcon    = UIManager.getIcon("FileView.directoryIcon");
	fileIcon         = UIManager.getIcon("FileView.fileIcon");
    
protected voidinstallListeners(javax.swing.JFileChooser fc)

	super.installListeners(fc);

	gtkFCPropertyChangeListener = new GTKFCPropertyChangeListener();
	fc.addPropertyChangeListener(gtkFCPropertyChangeListener);
    
protected voidinstallStrings(javax.swing.JFileChooser fc)

	super.installStrings(fc);

        Locale l = fc.getLocale();

        newFolderDialogText = UIManager.getString("FileChooser.newFolderDialogText", l);
        newFolderErrorText = UIManager.getString("FileChooser.newFolderErrorText",l);
        newFolderErrorSeparator = UIManager.getString("FileChooser.newFolderErrorSeparator",l);
	newFolderButtonText = UIManager.getString("FileChooser.newFolderButtonText", l);
	deleteFileButtonText = UIManager.getString("FileChooser.deleteFileButtonText", l);
	renameFileButtonText = UIManager.getString("FileChooser.renameFileButtonText", l);

	newFolderButtonMnemonic = getMnemonic("FileChooser.newFolderButtonMnemonic", l);
	deleteFileButtonMnemonic = getMnemonic("FileChooser.deleteFileButtonMnemonic", l);
	renameFileButtonMnemonic = getMnemonic("FileChooser.renameFileButtonMnemonic", l);

	newFolderButtonToolTipText = UIManager.getString("FileChooser.newFolderButtonToolTipText", l);
	deleteFileButtonToolTipText = UIManager.getString("FileChooser.deleteFileButtonToolTipText", l);
	renameFileButtonToolTipText = UIManager.getString("FileChooser.renameFileButtonToolTipText", l);

        renameFileDialogText = UIManager.getString("FileChooser.renameFileDialogText", l); 
        renameFileErrorTitle = UIManager.getString("FileChooser.renameFileErrorTitle", l);
        renameFileErrorText = UIManager.getString("FileChooser.renameFileErrorText", l);

	foldersLabelText = UIManager.getString("FileChooser.foldersLabelText",l);
        foldersLabelMnemonic = getMnemonic("FileChooser.foldersLabelMnemonic", l);
        
	filesLabelText = UIManager.getString("FileChooser.filesLabelText",l);
        filesLabelMnemonic = getMnemonic("FileChooser.filesLabelMnemonic", l);
	
	pathLabelText = UIManager.getString("FileChooser.pathLabelText",l);
	pathLabelMnemonic = getMnemonic("FileChooser.pathLabelMnemonic", l); 

        filterLabelText = UIManager.getString("FileChooser.filterLabelText", l);
        filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic"); 
    
public voidinstallUI(javax.swing.JComponent c)

	accessoryPanel = new JPanel(new BorderLayout(10, 10));
	accessoryPanel.setName("GTKFileChooser.accessoryPanel");

	super.installUI(c);
    
public voidrescanCurrentDirectory(javax.swing.JFileChooser fc)

	getModel().validateFileCache();
    
public voidsetDirectoryName(java.lang.String dirname)

	pathField.setText(dirname);
    
public voidsetFileName(java.lang.String fileName)

	if (fileNameTextField != null) {
	    fileNameTextField.setText(fileName);
	}
    
protected voiduninstallListeners(javax.swing.JFileChooser fc)

	super.uninstallListeners(fc);

	if (gtkFCPropertyChangeListener != null) {
	    fc.removePropertyChangeListener(gtkFCPropertyChangeListener);
	}
    
protected voiduninstallStrings(javax.swing.JFileChooser fc)

	super.uninstallStrings(fc);

	newFolderButtonText = null;
	deleteFileButtonText = null;
	renameFileButtonText = null;

	newFolderButtonToolTipText = null;
	deleteFileButtonToolTipText = null;
	renameFileButtonToolTipText = null;

        renameFileDialogText = null; 
        renameFileErrorTitle = null; 
        renameFileErrorText = null; 

	foldersLabelText = null;
	filesLabelText = null;
	
	pathLabelText = null;

        newFolderDialogText = null;
        newFolderErrorText = null;
        newFolderErrorSeparator = null;
    
public voiduninstallUI(javax.swing.JComponent c)

        c.removePropertyChangeListener(filterComboBoxModel);
        super.uninstallUI(c);

	if (accessoryPanel != null) {
	    accessoryPanel.removeAll();
	}
	accessoryPanel = null;
	getFileChooser().removeAll();
    
private voidupdateDefaultButton()

	JFileChooser filechooser = getFileChooser();
	JRootPane root = SwingUtilities.getRootPane(filechooser);
	if (root == null) {
	    return;
	}

	if (filechooser.getControlButtonsAreShown()) {
	    if (root.getDefaultButton() == null) {
		root.setDefaultButton(getApproveButton(filechooser));
		getCancelButton(filechooser).setDefaultCapable(false);
	    }
	} else {
	    if (root.getDefaultButton() == getApproveButton(filechooser)) {
		root.setDefaultButton(null);
	    }
	}