Here you can find the source of openDataFileChooser(Component com)
Parameter | Description |
---|---|
com | parent frame. |
public static JFileChooser openDataFileChooser(Component com)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import javax.swing.*; import javax.swing.filechooser.*; public class Main { /**/*from w ww .j av a 2 s .com*/ * File chooser to read data files. * * @param com * parent frame. * @return */ public static JFileChooser openDataFileChooser(Component com) { JFileChooser fileChooser = new JFileChooser(); fileChooser.removeChoosableFileFilter(fileChooser.getAcceptAllFileFilter()); // fileChooser.setCurrentDirectory(new // File(System.getProperty("user.home"))); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.addChoosableFileFilter( new FileNameExtensionFilter("All *.jser,*.jxml,*.jpbu,*.jdat,*.root,*.aida,*.xml", "jser", "jxml", "jpbu", "jdat", "root", "aida", "xml")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("HFile (*.jser)", "jser")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("HFileXML (*.jxml)", "jxml")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PFile (*.jpbu)", "jpbu")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("HBook (*.jdat)", "jdat")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ROOT (*.root)", "root")); fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("AIDA (*.aida *.xml)", "aida", "xml")); fileChooser.setAcceptAllFileFilterUsed(true); return fileChooser; } }