Java JFileChooser getIcon(File file)

Here you can find the source of getIcon(File file)

Description

get Icon

License

Open Source License

Declaration

public static Icon getIcon(File file) 

Method Source Code

//package com.java2s;
/*************************************************************************
    /* ww w .ja  v a  2s  . c om*/
Copyright (C) 2009 Grandite
    
This file is part of Open ModelSphere.
    
Open ModelSphere is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
or see http://www.gnu.org/licenses/.
    
You can redistribute and/or modify this particular file even under the
terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
    
You should have received a copy of the GNU Lesser General Public License 
(LGPL) along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
or see http://www.gnu.org/licenses/.
    
You can reach Grandite at: 
    
20-1220 Lebourgneuf Blvd.
Quebec, QC
Canada  G2K 2G4
    
or
    
open-modelsphere@grandite.com
    
 **********************************************************************/

import java.io.File;

import javax.swing.Icon;
import javax.swing.JFileChooser;

public class Main {
    private static final JFileChooser basicChooser = new JFileChooser();

    public static Icon getIcon(File file) {
        if (file == null) {
            return null;
        }
        return basicChooser.getIcon(file);
    }
}

Related

  1. getFiles(String title, String initialRoot, String initialFile)
  2. getFilesToOpen(File startDirectory, Component parent, String... filters)
  3. getFileToSave(String description, String extension, Component component)
  4. getFileWithExtension(JFileChooser c)
  5. getFixedFileChooser(File file)
  6. getJFileChooser(String title, File initialDirectory, File initialFile, final FilenameFilter filter, int directoryMode)
  7. getLoadFilename(Component parent)
  8. getLoadFiles(String message, File openDefaultDirectory, String description, String... extensions)
  9. getNewFileChooser()