Here you can find the source of createUserDefinedProfileFileChooser()
public static JFileChooser createUserDefinedProfileFileChooser()
//package com.java2s; /* $Id$/*from w w w . j a v a 2 s . c om*/ ***************************************************************************** * Copyright (c) 2009 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * thn ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ import java.io.File; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; public class Main { /** * Creates a JFileChooser which is appropriate for opening multiple files * containing user defined profiles. * * @return a JFileChooser */ public static JFileChooser createUserDefinedProfileFileChooser() { JFileChooser fileChooser = new JFileChooser(); fileChooser .setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setMultiSelectionEnabled(true); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File file) { String s = file.getName().toLowerCase(); return file.isDirectory() || (file.isFile() && (s.endsWith(".xmi") || s.endsWith(".xml") || s.endsWith(".uml") // for AndroMDA || s.endsWith(".xmi.zip") || s .endsWith(".xml.zip"))); } public String getDescription() { return "*.xmi *.xml *.xmi.zip *.xml.zip"; } }); return fileChooser; } }