/** * For testing only. * * @param args ignored */ public static void main(String[] args) { BaseDirectoryChooser chooser = new BaseDirectoryChooser(); chooser.setCurrentDirectory(new File(System.getProperty("java.io.tmpdir"))); if (chooser.showOpenDialog(null) == BaseDirectoryChooser.APPROVE_OPTION) System.out.println(chooser.getSelectedFile()); } }
/** * For initializing some stuff. * <br><br> * Default implementation does nothing. */ protected void initialize() { JComponent accessory; setRecentListVisible(false); accessory = createAccessoryPanel(); if (accessory != null) setAccessory(accessory); showBookmarks(false); setPreferredSize(new Dimension(400, 500)); }
/** * Creates a BaseDirectoryChooser using the given path. * * @param currentDirectoryPath the directory to start in */ public BaseDirectoryChooser(String currentDirectoryPath) { super(currentDirectoryPath); initialize(); }
/** * Performs the actual choosing of an object. * * @return the chosen object or null if none chosen */ protected File doChoose() { m_DirectoryChooser.setSelectedFile(getCurrent()); if (m_DirectoryChooser.showOpenDialog(m_Self) == BaseDirectoryChooser.APPROVE_OPTION) { return m_DirectoryChooser.getSelectedFile(); } else { return null; } }
/** * Initializes the members. */ protected void initialize() { super.initialize(); m_DirectoryChooser = new BaseDirectoryChooser(); }
@Override public void actionPerformed(ActionEvent e) { showBookmarks(!m_PanelBookmarks.isVisible()); } });
/** * Sets the current value. * * @param value the value to use, can be null * @return true if successfully set */ public boolean setCurrent(File value) { boolean result; result = super.setCurrent(value); m_DirectoryChooser.setSelectedFile(getCurrent().getAbsoluteFile()); return result; }
/** * Creates a BaseDirectoryChooser using the given path and FileSystemView. * * @param currentDirectoryPath the directory to start in * @param fsv the view to use */ public BaseDirectoryChooser(String currentDirectoryPath, FileSystemView fsv) { super(currentDirectoryPath, fsv); initialize(); }
/** * Creates a BaseDirectoryChooser pointing to the user's home directory. */ public BaseDirectoryChooser() { super(); initialize(); }
/** * Creates a BaseDirectoryChooser using the given FileSystemView. * * @param fsv the view to use */ public BaseDirectoryChooser(FileSystemView fsv) { super(fsv); initialize(); }
/** * Creates a BaseDirectoryChooser using the given File as the path. * * @param currentDirectory the directory to start in */ public BaseDirectoryChooser(File currentDirectory) { super(currentDirectory.getAbsoluteFile()); initialize(); }
/** * Creates a BaseDirectoryChooser using the given current directory and * FileSystemView. * * @param currentDirectory the directory to start in * @param fsv the view to use */ public BaseDirectoryChooser(File currentDirectory, FileSystemView fsv) { super(currentDirectory.getAbsoluteFile(), fsv); initialize(); }