/** Handles the open event. */ public final void handleOpen() { logger.debug("handleOpen", "handle open"); // $NON-NLS-1$ //$NON-NLS-2$ if (this.gui.jGTIFileChooser.getUI() instanceof BasicFileChooserUI) { BasicFileChooserUI ui = (BasicFileChooserUI) this.gui.jGTIFileChooser.getUI(); ui.getApproveSelectionAction().actionPerformed(null); } else { throw new RuntimeException("ui is not a BasicFileChooserUI"); // $NON-NLS-1$ } if ((getSelectedFile() != null) && !getSelectedFile().isDirectory()) { this.confirmed = true; this.gui.dispose(); } }
public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY || prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY || prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY || prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY || prop == JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) { validateFileCache(); } else if ("UI".equals(prop)) { Object old = e.getOldValue(); if (old instanceof BasicFileChooserUI) { BasicFileChooserUI ui = (BasicFileChooserUI) old; BasicDirectoryModel model = ui.getModel(); if (model != null) { model.invalidateFileCache(); } } } else if ("JFileChooserDialogIsClosingProperty".equals(prop)) { invalidateFileCache(); } }
@Override public File getSelectedFile() { File ret; JFileChooser fc = getFileChooser(); FileChooserUI ui = fc.getUI(); if (ui instanceof BasicFileChooserUI) { BasicFileChooserUI basicUI = (BasicFileChooserUI) ui; String fileName = basicUI.getFileName(); if ((fileName == null) || (fileName.length() == 0)) { ret = null; } else { ret = autoComplete(new File(fileName)); } } else { ret = autoComplete(super.getSelectedFile()); } if ((ret != null) && !ret.isAbsolute()) { ret = new File(fc.getCurrentDirectory(), ret.getName()); } return ret; }
protected void installStrings(JFileChooser fc) { super.installStrings(fc); Locale l = fc.getLocale(); enterFileNameLabelText = UIManager.getString("FileChooser.enterFileNameLabelText", l); enterFileNameLabelMnemonic = UIManager.getInt("FileChooser.enterFileNameLabelMnemonic"); filesLabelText = UIManager.getString("FileChooser.filesLabelText", l); filesLabelMnemonic = UIManager.getInt("FileChooser.filesLabelMnemonic"); foldersLabelText = UIManager.getString("FileChooser.foldersLabelText", l); foldersLabelMnemonic = UIManager.getInt("FileChooser.foldersLabelMnemonic"); pathLabelText = UIManager.getString("FileChooser.pathLabelText", l); pathLabelMnemonic = UIManager.getInt("FileChooser.pathLabelMnemonic"); filterLabelText = UIManager.getString("FileChooser.filterLabelText", l); filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic"); }
public void uninstallUI(JComponent c) { getFileChooser().removeAll(); super.uninstallUI(c); }
public void installUI(JComponent c) { super.installUI(c); }