sun.swing.FilePane Java Examples
The following examples show how to use
sun.swing.FilePane.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JSystemFileChooser.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
public void updateUI(){ LookAndFeel old = UIManager.getLookAndFeel(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable ex) { old = null; } super.updateUI(); if(old != null){ FilePane filePane = findFilePane(this); filePane.setViewType(FilePane.VIEWTYPE_DETAILS); filePane.setViewType(FilePane.VIEWTYPE_LIST); Color background = UIManager.getColor("Label.background"); setBackground(background); setOpaque(true); try { UIManager.setLookAndFeel(old); } catch (UnsupportedLookAndFeelException ignored) {} // shouldn't get here } }
Example #2
Source File: DarkFileChooserUI.java From darklaf with MIT License | 6 votes |
protected DarkFilePaneUIBridge createFilePane(final JFileChooser fileChooser) { DarkFilePaneUIBridge filePane = new DarkFilePane(new MetalFileChooserUIAccessor()); fileChooser.addPropertyChangeListener(filePane); // ComboBox Label filePane.addPropertyChangeListener(e -> { if (KEY_VIEW_TYPE.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; } } }); filePane.setPreferredSize(LIST_PREF_SIZE); return filePane; }
Example #3
Source File: JSystemFileChooser.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
private static FilePane findFilePane(Container parent){ for(Component comp: parent.getComponents()){ if(FilePane.class.isInstance(comp)){ return (FilePane)comp; } if(comp instanceof Container){ Container cont = (Container)comp; if(cont.getComponentCount() > 0){ FilePane found = findFilePane(cont); if (found != null) { return found; } } } } return null; }
Example #4
Source File: SnapFileChooser.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
@Override public void windowClosed(WindowEvent e) { FilePane filePane = findFilePane(SnapFileChooser.this); if (filePane != null) { snapPreferences.putInt(PREFERENCES_VIEW_TYPE, filePane.getViewType()); flushPreferences(); } }
Example #5
Source File: SnapFileChooser.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private void initViewType() { FilePane filePane = findFilePane(this); if (filePane != null) { int viewType = snapPreferences.getInt(PREFERENCES_VIEW_TYPE, FilePane.VIEWTYPE_LIST); filePane.setViewType(viewType); } }
Example #6
Source File: SnapFileChooser.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private FilePane findFilePane(Container root) { Component[] components = root.getComponents(); for (Component component : components) { if (component instanceof FilePane) { return (FilePane) component; } if (component instanceof Container) { FilePane filePane = findFilePane((Container) component); if (filePane != null) { return filePane; } } } return null; }
Example #7
Source File: DarkFileChooserUI.java From darklaf with MIT License | 5 votes |
protected JToggleButton createListViewButton() { JToggleButton button = new TooltipAwareToggleButton(listViewIcon); setupButton(button, listViewButtonAccessibleName, listViewButtonToolTipText); Icon selectedListViewIcon = UIManager.getIcon("FileChooser.listViewSelectedIcon"); button.setSelectedIcon(selectedListViewIcon); button.putClientProperty(DarkButtonUI.KEY_CORNER, AlignmentExt.LEFT); button.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_LIST)); button.setSelected(true); return button; }
Example #8
Source File: DarkFilePaneUIBridge.java From darklaf with MIT License | 5 votes |
@SuppressWarnings("serial") // anonymous class inside public Action getNewFolderAction() { if (!readOnly && newFolderAction == null) { newFolderAction = new AbstractAction(newFolderActionLabelText) { protected Action basicNewFolderAction; // Initializer { putValue(Action.ACTION_COMMAND_KEY, FilePane.ACTION_NEW_FOLDER); File currentDirectory = getFileChooser().getCurrentDirectory(); if (currentDirectory != null) { setEnabled(canWrite(currentDirectory, getFileChooser())); } } public void actionPerformed(final ActionEvent ev) { if (basicNewFolderAction == null) { basicNewFolderAction = fileChooserUIAccessor.getNewFolderAction(); } JFileChooser fc = getFileChooser(); File oldFile = fc.getSelectedFile(); basicNewFolderAction.actionPerformed(ev); File newFile = fc.getSelectedFile(); if (newFile != null && !newFile.equals(oldFile) && newFile.isDirectory()) { newFolderFile = newFile; } } }; } return newFolderAction; }
Example #9
Source File: DarkFileChooserUI.java From darklaf with MIT License | 5 votes |
protected JToggleButton createDetailsViewButton() { JToggleButton button = new TooltipAwareToggleButton(detailsViewIcon); setupButton(button, detailsViewButtonAccessibleName, detailsViewButtonToolTipText); Icon selectedDetailsViewIcon = UIManager.getIcon("FileChooser.detailsViewSelectedIcon"); button.setSelectedIcon(selectedDetailsViewIcon); button.putClientProperty(DarkButtonUI.KEY_CORNER, AlignmentExt.RIGHT); button.addActionListener(filePane.getViewTypeAction(FilePane.VIEWTYPE_DETAILS)); return button; }
Example #10
Source File: GTKFileChooserUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #11
Source File: GTKFileChooserUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #12
Source File: GTKFileChooserUI.java From hottub with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #13
Source File: GTKFileChooserUI.java From hottub with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #14
Source File: GTKFileChooserUI.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #15
Source File: GTKFileChooserUI.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #16
Source File: GTKFileChooserUI.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #17
Source File: GTKFileChooserUI.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #18
Source File: GTKFileChooserUI.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #19
Source File: GTKFileChooserUI.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #20
Source File: GTKFileChooserUI.java From Bytecoder with Apache License 2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #21
Source File: GTKFileChooserUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #22
Source File: GTKFileChooserUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #23
Source File: GTKFileChooserUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #24
Source File: GTKFileChooserUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #25
Source File: GTKFileChooserUI.java From JDKSourceCode1.8 with MIT License | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #26
Source File: DarkFileChooserUIBridge.java From darklaf with MIT License | 4 votes |
/** * Adds the directory to the model and sets it to be selected, additionally clears out the previous selected * directory and the paths leading up to it, if any. * * @param directory the directory */ protected void addItem(final File directory) { if (directory == null) { return; } boolean useShellFolder = FilePane.usesShellFolder(chooser); directories.clear(); File[] baseFolders = (useShellFolder) ? (File[]) ShellFolder.get("fileChooserComboBoxFolders") : fsv.getRoots(); directories.addAll(Arrays.asList(baseFolders)); // Get the canonical (full) path. This has the side // benefit of removing extraneous chars from the path, // for example /foo/bar/ becomes /foo/bar File canonical; try { canonical = ShellFolder.getNormalizedFile(directory); } catch (IOException e) { // Maybe drive is not ready. Can't abort here. canonical = directory; } // create File instances of each directory leading up to the top try { File sf = useShellFolder ? ShellFolder.getShellFolder(canonical) : canonical; File f = sf; Vector<File> path = new Vector<>(10); do { path.addElement(f); } while ((f = f.getParentFile()) != null); int pathCount = path.size(); // Insert chain at appropriate place in vector for (int i = 0; i < pathCount; i++) { f = path.get(i); if (directories.contains(f)) { int topIndex = directories.indexOf(f); for (int j = i - 1; j >= 0; j--) { directories.insertElementAt(path.get(j), topIndex + i - j); } break; } } calculateDepths(); setSelectedItem(sf); } catch (FileNotFoundException ex) { calculateDepths(); } }
Example #27
Source File: GTKFileChooserUI.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #28
Source File: GTKFileChooserUI.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }
Example #29
Source File: GTKFileChooserUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); }
Example #30
Source File: GTKFileChooserUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); }