OSDN Git Service

fix:GPXファイル単体選択を可能にしました
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / ParameterPanelFolder.java
index 31369c4..517df40 100644 (file)
@@ -11,36 +11,32 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
        JFileChooser fc;
        JButton openButton;
 
-       public ParameterPanelFolder(String label, String text) {
+       public ParameterPanelFolder(String label, String text, boolean onlyDir) {
                super(label, text);
 
         //Create a file chooser
                File sdir = new File(text);
-               if (sdir.isDirectory()) {
+               
+               if (sdir.exists()) {
                fc = new JFileChooser(sdir);
                }
                else {
                fc = new JFileChooser();
                }
-        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-
-        //Uncomment one of the following lines to try a different
-        //file selection mode.  The first allows just directories
-        //to be selected (and, at least in the Java look and feel,
-        //shown).  The second allows both files and directories
-        //to be selected.  If you leave these lines commented out,
-        //then the default mode (FILES_ONLY) will be used.
-        //
-        //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-        //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+               
+               if (onlyDir) {
+                       fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+               }
 
-        //Create the open button.  We use the image from the JLF
-        //Graphics Repository (but we extracted it from the jar).
         openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
         openButton.addActionListener(this);
         this.add(openButton);
        }
        
+       public ParameterPanelFolder(String label, String text) {
+               this(label, text, true);
+       }
+       
        public void setEnable(boolean f) {
                super.setEnabled(f);
                openButton.setEnabled(f);