예제 #1
0
 private String askUser() {
   if (dir) {
     return FileDialogs.getNewDir(
         frame, new File(comp.getText()), Globals.NONE, JFileChooser.OPEN_DIALOG, false);
   } else {
     return FileDialogs.getNewFile(
         frame, new File(comp.getText()), Globals.NONE, JFileChooser.OPEN_DIALOG, false);
   }
 }
 @Override
 public void actionPerformed(ActionEvent e) {
   String chosen;
   if (dir) {
     chosen =
         FileDialogs.getNewDir(
             frame, new File(comp.getText()), Globals.NONE, JFileChooser.OPEN_DIALOG, false);
   } else {
     chosen =
         FileDialogs.getNewFile(
             frame, new File(comp.getText()), Globals.NONE, JFileChooser.OPEN_DIALOG, false);
   }
   if (chosen != null) {
     File nFile = new File(chosen);
     comp.setText(nFile.getPath());
   }
 }