Methods Summary |
---|
protected void | addControlButtons()
getBottomPanel().add(getButtonPanel());
|
protected javax.swing.ActionMap | createActionMap()
ActionMap map = new ActionMapUIResource();
FilePane.addActionsToMap(map, filePane.getActions());
return map;
|
protected javax.swing.JPanel | createDetailsView(javax.swing.JFileChooser fc)
return filePane.createDetailsView();
|
protected com.sun.java.swing.plaf.windows.WindowsFileChooserUI$DirectoryComboBoxModel | createDirectoryComboBoxModel(javax.swing.JFileChooser fc)
return new DirectoryComboBoxModel();
|
protected com.sun.java.swing.plaf.windows.WindowsFileChooserUI$DirectoryComboBoxRenderer | createDirectoryComboBoxRenderer(javax.swing.JFileChooser fc)
return new DirectoryComboBoxRenderer();
|
protected com.sun.java.swing.plaf.windows.WindowsFileChooserUI$FilterComboBoxModel | createFilterComboBoxModel()
return new FilterComboBoxModel();
|
protected com.sun.java.swing.plaf.windows.WindowsFileChooserUI$FilterComboBoxRenderer | createFilterComboBoxRenderer()
return new FilterComboBoxRenderer();
|
protected javax.swing.JPanel | createList(javax.swing.JFileChooser fc)
return filePane.createList();
|
public javax.swing.event.ListSelectionListener | createListSelectionListener(javax.swing.JFileChooser fc)Creates a selection listener for the list of files and directories.
return super.createListSelectionListener(fc);
|
public java.beans.PropertyChangeListener | createPropertyChangeListener(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 == "FileChooser.useShellFolder") {
updateUseShellFolder();
doDirectoryChanged(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.equals("ancestor")) {
if (e.getOldValue() == null && e.getNewValue() != null) {
// Ancestor was added, set initial focus
filenameTextField.selectAll();
filenameTextField.requestFocus();
}
}
}
};
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)
//
// ComponentUI Interface Implementation methods
//
return new WindowsFileChooserUI((JFileChooser) c);
|
private void | doAccessoryChanged(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 void | doApproveButtonMnemonicChanged(java.beans.PropertyChangeEvent e)
approveButton.setMnemonic(getApproveButtonMnemonic(getFileChooser()));
|
private void | doApproveButtonTextChanged(java.beans.PropertyChangeEvent e)
JFileChooser chooser = getFileChooser();
approveButton.setText(getApproveButtonText(chooser));
approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
approveButton.setMnemonic(getApproveButtonMnemonic(chooser));
|
private void | doControlButtonsChanged(java.beans.PropertyChangeEvent e)
if(getFileChooser().getControlButtonsAreShown()) {
addControlButtons();
} else {
removeControlButtons();
}
|
private void | doDialogTypeChanged(java.beans.PropertyChangeEvent e)
JFileChooser chooser = getFileChooser();
approveButton.setText(getApproveButtonText(chooser));
approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
approveButton.setMnemonic(getApproveButtonMnemonic(chooser));
if (chooser.getDialogType() == JFileChooser.SAVE_DIALOG) {
lookInLabel.setText(saveInLabelText);
} else {
lookInLabel.setText(lookInLabelText);
}
|
private void | doDirectoryChanged(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 void | doFileSelectionModeChanged(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 void | doFilterChanged(java.beans.PropertyChangeEvent e)
clearIconCache();
|
private void | doSelectedFileChanged(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 void | doSelectedFilesChanged(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 void | ensureFileIsVisible(javax.swing.JFileChooser fc, java.io.File f)
filePane.ensureFileIsVisible(fc, f);
|
private java.lang.String | fileNameString(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.String | fileNameString(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.ActionMap | getActionMap()
return createActionMap();
|
protected javax.swing.JButton | getApproveButton(javax.swing.JFileChooser fc)
return approveButton;
|
protected javax.swing.JPanel | getBottomPanel()
if(bottomPanel == null) {
bottomPanel = new JPanel();
}
return bottomPanel;
|
protected javax.swing.JPanel | getButtonPanel()
if(buttonPanel == null) {
buttonPanel = new JPanel();
}
return buttonPanel;
|
public java.lang.String | getDirectoryName()
// PENDING(jeff) - get the name from the directory combobox
return null;
|
public java.lang.String | getFileName()
if(filenameTextField != null) {
return filenameTextField.getText();
} else {
return null;
}
|
public javax.swing.filechooser.FileView | getFileView(javax.swing.JFileChooser fc)
return fileView;
|
public java.awt.Dimension | getMaximumSize(javax.swing.JComponent c)Returns the maximum size of the JFileChooser .
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
public java.awt.Dimension | getMinimumSize(javax.swing.JComponent c)Returns the minimum size of the JFileChooser .
return MIN_SIZE;
|
public java.awt.Dimension | getPreferredSize(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.
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);
}
|
public void | installComponents(javax.swing.JFileChooser fc)
filePane = new FilePane(new WindowsFileChooserUIAccessor());
fc.addPropertyChangeListener(filePane);
FileSystemView fsv = fc.getFileSystemView();
fc.setBorder(new EmptyBorder(4, 10, 10, 10));
fc.setLayout(new BorderLayout(8, 8));
updateUseShellFolder();
// ********************************* //
// **** Construct the top panel **** //
// ********************************* //
// Directory manipulation buttons
JToolBar topPanel = new JToolBar();
topPanel.setFloatable(false);
if (OS_VERSION.compareTo("4.9") >= 0) { // Windows Me/2000 and later (4.90/5.0)
topPanel.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
}
// 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() {
Dimension d = super.getPreferredSize();
if (placesBar != null) {
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() {
public Dimension getMinimumSize() {
Dimension d = super.getMinimumSize();
d.width = 60;
return d;
}
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
// Must be small enough to not affect total width.
d.width = 150;
return d;
}
};
directoryComboBox.putClientProperty( "JComboBox.lightweightKeyboardNavigation", "Lightweight" );
lookInLabel.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);
directoryComboBox.setMaximumRowCount(8);
topPanel.add(directoryComboBox);
topPanel.add(Box.createRigidArea(hstrut10));
// Up Button
JButton upFolderButton = new JButton(getChangeToParentDirectoryAction());
upFolderButton.setText(null);
upFolderButton.setIcon(upFolderIcon);
upFolderButton.setToolTipText(upFolderToolTipText);
upFolderButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
upFolderAccessibleName);
upFolderButton.putClientProperty(WindowsLookAndFeel.HI_RES_DISABLED_ICON_CLIENT_KEY,
Boolean.TRUE);
upFolderButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
upFolderButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
upFolderButton.setMargin(shrinkwrap);
upFolderButton.setFocusPainted(false);
topPanel.add(upFolderButton);
if (OS_VERSION.compareTo("4.9") < 0) { // Before Windows Me/2000 (4.90/5.0)
topPanel.add(Box.createRigidArea(hstrut10));
}
JButton b;
if (OS_VERSION.startsWith("4.1")) { // Windows 98 (4.10)
// Desktop Button
File homeDir = fsv.getHomeDirectory();
String toolTipText = homeFolderToolTipText;
if (fsv.isRoot(homeDir)) {
toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
}
b = new JButton(getFileView(fc).getIcon(homeDir));
b.setToolTipText(toolTipText);
b.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
toolTipText);
b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
b.setMargin(shrinkwrap);
b.setFocusPainted(false);
b.addActionListener(getGoHomeAction());
topPanel.add(b);
topPanel.add(Box.createRigidArea(hstrut10));
}
// 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.putClientProperty(WindowsLookAndFeel.HI_RES_DISABLED_ICON_CLIENT_KEY,
Boolean.TRUE);
b.setAlignmentX(JComponent.LEFT_ALIGNMENT);
b.setAlignmentY(JComponent.CENTER_ALIGNMENT);
b.setMargin(shrinkwrap);
b.setFocusPainted(false);
topPanel.add(b);
}
if (OS_VERSION.compareTo("4.9") < 0) { // Before Windows Me/2000 (4.90/5.0)
topPanel.add(Box.createRigidArea(hstrut10));
}
// View button group
ButtonGroup viewButtonGroup = new ButtonGroup();
// List Button
listViewButton = new JToggleButton(listViewIcon);
listViewButton.setToolTipText(listViewButtonToolTipText);
listViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
listViewButtonAccessibleName);
listViewButton.putClientProperty(WindowsLookAndFeel.HI_RES_DISABLED_ICON_CLIENT_KEY,
Boolean.TRUE);
listViewButton.setFocusPainted(false);
listViewButton.setSelected(true);
listViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
listViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
listViewButton.setMargin(shrinkwrap);
listViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_LIST));
topPanel.add(listViewButton);
viewButtonGroup.add(listViewButton);
// Details Button
detailsViewButton = new JToggleButton(detailsViewIcon);
detailsViewButton.setToolTipText(detailsViewButtonToolTipText);
detailsViewButton.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY,
detailsViewButtonAccessibleName);
detailsViewButton.putClientProperty(WindowsLookAndFeel.HI_RES_DISABLED_ICON_CLIENT_KEY,
Boolean.TRUE);
detailsViewButton.setFocusPainted(false);
detailsViewButton.setAlignmentX(JComponent.LEFT_ALIGNMENT);
detailsViewButton.setAlignmentY(JComponent.CENTER_ALIGNMENT);
detailsViewButton.setMargin(shrinkwrap);
detailsViewButton.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_DETAILS));
topPanel.add(detailsViewButton);
viewButtonGroup.add(detailsViewButton);
topPanel.add(Box.createRigidArea(new Dimension(60, 0)));
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 ******* //
// ************************************** //
centerPanel = new JPanel(new BorderLayout());
centerPanel.add(getAccessoryPanel(), BorderLayout.AFTER_LINE_ENDS);
JComponent accessory = fc.getAccessory();
if(accessory != null) {
getAccessoryPanel().add(accessory);
}
filePane.setPreferredSize(LIST_PREF_SIZE);
centerPanel.add(filePane, BorderLayout.CENTER);
fc.add(centerPanel, BorderLayout.CENTER);
// ********************************** //
// **** Construct the bottom panel ** //
// ********************************** //
getBottomPanel().setLayout(new BoxLayout(getBottomPanel(), BoxLayout.LINE_AXIS));
// Add the bottom panel to file chooser
centerPanel.add(getBottomPanel(), BorderLayout.SOUTH);
// labels
JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.PAGE_AXIS));
labelPanel.add(Box.createRigidArea(vstrut4));
JLabel fnl = new JLabel(fileNameLabelText);
fnl.setDisplayedMnemonic(fileNameLabelMnemonic);
fnl.setAlignmentY(0);
labelPanel.add(fnl);
labelPanel.add(Box.createRigidArea(new Dimension(1,12)));
JLabel ftl = new JLabel(filesOfTypeLabelText);
ftl.setDisplayedMnemonic(filesOfTypeLabelMnemonic);
labelPanel.add(ftl);
getBottomPanel().add(labelPanel);
getBottomPanel().add(Box.createRigidArea(new Dimension(15, 0)));
// 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);
}
};
fnl.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()));
}
fileAndFilterPanel.add(filenameTextField);
fileAndFilterPanel.add(Box.createRigidArea(vstrut8));
filterComboBoxModel = createFilterComboBoxModel();
fc.addPropertyChangeListener(filterComboBoxModel);
filterComboBox = new JComboBox(filterComboBoxModel);
ftl.setLabelFor(filterComboBox);
filterComboBox.setRenderer(createFilterComboBoxRenderer());
fileAndFilterPanel.add(filterComboBox);
getBottomPanel().add(fileAndFilterPanel);
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));
approveButton.addActionListener(getApproveSelectionAction());
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);
if(fc.getControlButtonsAreShown()) {
addControlButtons();
}
|
protected void | installListeners(javax.swing.JFileChooser fc)
super.installListeners(fc);
ActionMap actionMap = getActionMap();
SwingUtilities.replaceUIActionMap(fc, actionMap);
|
protected void | installStrings(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 void | installUI(javax.swing.JComponent c)
super.installUI(c);
|
protected void | removeControlButtons()
getBottomPanel().remove(getButtonPanel());
|
public void | rescanCurrentDirectory(javax.swing.JFileChooser fc)
filePane.rescanCurrentDirectory();
|
public void | setDirectoryName(java.lang.String dirname)
// PENDING(jeff) - set the name in the directory combobox
|
protected void | setDirectorySelected(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.
super.setDirectorySelected(directorySelected);
JFileChooser chooser = getFileChooser();
if(directorySelected) {
approveButton.setText(directoryOpenButtonText);
approveButton.setToolTipText(directoryOpenButtonToolTipText);
approveButton.setMnemonic(directoryOpenButtonMnemonic);
} else {
approveButton.setText(getApproveButtonText(chooser));
approveButton.setToolTipText(getApproveButtonToolTipText(chooser));
approveButton.setMnemonic(getApproveButtonMnemonic(chooser));
}
|
public void | setFileName(java.lang.String filename)
if(filenameTextField != null) {
filenameTextField.setText(filename);
}
|
public void | uninstallComponents(javax.swing.JFileChooser fc)
fc.removeAll();
|
public void | uninstallUI(javax.swing.JComponent c)
// Remove listeners
c.removePropertyChangeListener(filterComboBoxModel);
c.removePropertyChangeListener(filePane);
if (placesBar != null) {
c.removePropertyChangeListener(placesBar);
}
cancelButton.removeActionListener(getCancelSelectionAction());
approveButton.removeActionListener(getApproveSelectionAction());
filenameTextField.removeActionListener(getApproveSelectionAction());
if (filePane != null) {
filePane.uninstallUI();
filePane = null;
}
super.uninstallUI(c);
|
private void | updateUseShellFolder()
// 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;
}
}
}
if (OS_VERSION.compareTo("4.9") >= 0) { // Windows Me/2000 and later (4.90/5.0)
if (useShellFolder) {
if (placesBar == null && !UIManager.getBoolean("FileChooser.noPlacesBar")) {
placesBar = new WindowsPlacesBar(fc, XPStyle.getXP() != null);
fc.add(placesBar, BorderLayout.BEFORE_LINE_BEGINS);
fc.addPropertyChangeListener(placesBar);
}
} else {
if (placesBar != null) {
fc.remove(placesBar);
fc.removePropertyChangeListener(placesBar);
placesBar = null;
}
}
}
|
public void | valueChanged(javax.swing.event.ListSelectionEvent e)
JFileChooser fc = getFileChooser();
File f = fc.getSelectedFile();
if (!e.getValueIsAdjusting() && f != null && !getFileChooser().isTraversable(f)) {
setFileName(fileNameString(f));
}
|