create Home File Chooser - Java Swing

Java examples for Swing:JFileChooser

Description

create Home File Chooser

Demo Code


//package com.java2s;

import java.io.File;
import javax.swing.JFileChooser;

import javax.swing.filechooser.FileSystemView;

public class Main {
    public static JFileChooser createHomeFileChooser() {
        FileSystemView systemView = FileSystemView.getFileSystemView();
        // Hijack to speed tests
        //File homeFile = systemView.getHomeDirectory();
        File homeFile = new File(
                "C:\\Users\\Camille\\Informatique\\projets\\Arene V2\\SpriteEditor\\Tests\\Test 2");

        return new JFileChooser(homeFile);
    }//from  www.ja v  a 2  s.  c o  m
}

Related Tutorials