java.awt.FileDialog.dispose()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中java.awt.FileDialog.dispose()方法的一些代码示例,展示了FileDialog.dispose()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileDialog.dispose()方法的具体详情如下:
包路径:java.awt.FileDialog
类名称:FileDialog
方法名:dispose

FileDialog.dispose介绍

暂无

代码示例

代码示例来源:origin: chewiebug/GCViewer

public void actionPerformed(final ActionEvent e) {
  if(OSXSupport.isOSX()) {
    // there is no way to show a checkbox on the native dialog so
    // open a new window instead
    FileDialog dialog = new FileDialog(gcViewer, LocalisationHelper.getString("fileopen_dialog_title"), FileDialog.LOAD);
    dialog.setMultipleMode(true);
    dialog.setVisible(true);
    // dialog.setFilenameFilter doesn't do much on OSX
    openFiles(dialog.getFiles(), false);
    dialog.dispose();
    return;
  }
  openFileView.setShowAddCheckBox(gcViewer.getSelectedGCDocument() != null);
  // TODO SWINGWORKER: open at last openposition (directory)
  final int val = openFileView.showOpenDialog(gcViewer);
  if (val == JFileChooser.APPROVE_OPTION) {
    openFiles(openFileView.getSelectedFiles(), openFileView.isAddCheckBoxSelected());
  }
}

代码示例来源:origin: elki-project/elki

/**
 * Button callback to show the file selector
 */
@Override
public void actionPerformed(ActionEvent e) {
 FileDialog fc = new FileDialog(frame);
 fc.setDirectory(defaultpath);
 fc.setMode(mode);
 final String curr = textfield.getText();
 if(curr != null && curr.length() > 0) {
  fc.setFile(curr);
 }
 fc.setVisible(true);
 String filename = fc.getFile();
 if(filename != null) {
  textfield.setText(new File(fc.getDirectory(), filename).getPath());
 }
 fc.setVisible(false);
 fc.dispose();
 textfield.requestFocus();
 fireEditingStopped();
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * Button callback to show the file selector
 */
@Override
public void actionPerformed(ActionEvent e) {
 FileDialog fc = new FileDialog(frame);
 fc.setDirectory(defaultpath);
 fc.setMode(mode);
 final String curr = textfield.getText();
 if(curr != null && curr.length() > 0) {
  fc.setFile(curr);
 }
 fc.setVisible(true);
 String filename = fc.getFile();
 if(filename != null) {
  textfield.setText(new File(fc.getDirectory(), filename).getPath());
 }
 fc.setVisible(false);
 fc.dispose();
 textfield.requestFocus();
 fireEditingStopped();
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-gui-minigui

/**
 * Button callback to show the file selector
 */
@Override
public void actionPerformed(ActionEvent e) {
 FileDialog fc = new FileDialog(frame);
 fc.setDirectory(defaultpath);
 fc.setMode(mode);
 final String curr = textfield.getText();
 if(curr != null && curr.length() > 0) {
  fc.setFile(curr);
 }
 fc.setVisible(true);
 String filename = fc.getFile();
 if(filename != null) {
  textfield.setText(new File(fc.getDirectory(), filename).getPath());
 }
 fc.setVisible(false);
 fc.dispose();
 textfield.requestFocus();
 fireEditingStopped();
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

public static File selectionFileDialog()
{
 
 final FileDialog fileDialog = new FileDialog((Frame) null, "Choose reachability map to load");
 fileDialog.setMode(FileDialog.LOAD);
 fileDialog.setVisible(true);
 String directory = fileDialog.getDirectory();
 String filename = fileDialog.getFile();
 fileDialog.dispose();
 if (directory != null && filename != null)
 {
   return new File(directory, filename);
 }
 else
 {
   return null;
 }
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces

public static File selectionFileDialog()
{
 
 final FileDialog fileDialog = new FileDialog((Frame) null, "Choose reachability map to load");
 fileDialog.setMode(FileDialog.LOAD);
 fileDialog.setVisible(true);
 String directory = fileDialog.getDirectory();
 String filename = fileDialog.getFile();
 fileDialog.dispose();
 if (directory != null && filename != null)
 {
   return new File(directory, filename);
 }
 else
 {
   return null;
 }
}

代码示例来源:origin: sc.fiji/TransformJ_

private String file(final int mode) {
  
  String file = null;
  final String m = (mode == FileDialog.LOAD) ? "Load" : "Save";
  final FileDialog fdg = new FileDialog(IJ.getInstance(),TJ.name()+": "+m,mode);
  fdg.setFile(""); fdg.setVisible(true);
  final String d = fdg.getDirectory();
  final String f = fdg.getFile();
  fdg.dispose();
  if (d != null && f != null) {
    file = d + f;
    if (File.separator.equals("\\"))
      file = file.replace('\\','/');
  }
  return file;
}

代码示例来源:origin: org.scijava/scijava-ui-awt

@Override
public void actionPerformed(final ActionEvent e) {
  File file = new File(path.getText());
  if (!file.isDirectory()) {
    file = file.getParentFile();
  }
  // display file chooser in appropriate mode
  final String style = get().getItem().getWidgetStyle();
  final FileDialog fileDialog = new FileDialog((Frame) null);
  if (FileWidget.SAVE_STYLE.equals(style)) {
    fileDialog.setMode(FileDialog.SAVE);
  }
  else { // default behavior
    fileDialog.setMode(FileDialog.LOAD);
  }
  fileDialog.setDirectory(file.getAbsolutePath());
  fileDialog.setVisible(true);
  final String filename = fileDialog.getFile();
  fileDialog.dispose();
  if (filename == null) return;
  path.setText(filename);
}

代码示例来源:origin: us.ihmc/RobotDataCommunication

fileDialog.dispose();
if(filename != null)

代码示例来源:origin: us.ihmc/ihmc-robot-data-visualizer

public static File loadDirectoryWithFileNamed(final String acceptedFileName)
{
 final FileDialog fileDialog = new FileDialog((Frame) null, "Choose logging directory");
 fileDialog.setMode(FileDialog.LOAD);
 
 if(acceptedFileName != null)
 {
   fileDialog.setFilenameFilter(new FilenameFilter()
   {
    
    @Override
    public boolean accept(File dir, String name)
    {
      return (acceptedFileName.equals(name));
    }
   });        
 }
 
 fileDialog.setVisible(true);         
 String filename = fileDialog.getDirectory();
 fileDialog.dispose();
 if(filename != null)
 {
   return new File(filename);
 }
 else
 {
   return null;
 }
}

代码示例来源:origin: us.ihmc/IHMCRobotDataLogger

fileDialog.dispose();
if(filename != null)

代码示例来源:origin: us.ihmc/ihmc-robot-data-visualizer

fileDialog.dispose();
if(filename != null)

代码示例来源:origin: org.ihtsdo/wb-api

private File openFileDialog(String prompt) {
    File theFile = null;
    FileDialog dialog = new FileDialog(new Frame(), prompt, FileDialog.LOAD);
    //
    // dialog.setDirectory(AceConfig.config.getProfileFile().getParentFile().getAbsolutePath());
//        dialog.setFilenameFilter(new FilenameFilter() {
//
//            @Override
//            public boolean accept(File dir, String name) {
//                return name.endsWith(".owl");
//            }
//        });
    // Display dialog and wait for response
    dialog.setVisible(true);
    // Check response
    if (dialog.getFile() != null) {
      theFile = new File(dialog.getDirectory(), dialog.getFile());
    }
    // Cleanup
    dialog.dispose();
    return theFile;
  }

代码示例来源:origin: sc.fiji/TransformJ_

public void actionPerformed(final ActionEvent e) {
  
  if (e.getSource() == browseButton) {
    final FileDialog fdg = new FileDialog(IJ.getInstance(),TJ.name()+": Load",FileDialog.LOAD);
    fdg.setFile(""); fdg.setVisible(true);
    final String d = fdg.getDirectory();
    final String f = fdg.getFile();
    fdg.dispose();
    if (d != null && f != null) {
      String path = d + f;
      if (File.separator.equals("\\"))
        path = path.replace('\\','/');
      fileField.setText(path);
    }
  } else if (e.getSource() == createButton) {
    final TJ_Matrix matrix = new TJ_Matrix();
    try { matrix.load(fileField.getText()); }
    catch (Throwable x) { }
    matrix.run("");
    final String path = matrix.saved();
    if (path != null) fileField.setText(path);
  }
}

代码示例来源:origin: sc.fiji/FlowJ_

private void doSave()
/*
   Save the flow field in a file.
*/
{
   FileDialog fd = new FileDialog(this.win, "Save flow in file...", FileDialog.SAVE);
     if (defaultDirectory!=null)
        fd.setDirectory(defaultDirectory);
     fd.setFile(description+".flow");
   fd.setVisible(true);
     String name = fd.getFile();
     String directory = fd.getDirectory();
     defaultDirectory = directory;
     fd.dispose();
   flow.write(directory+name);
}
/**

代码示例来源:origin: net.imagej/ij

if (name==null)
  Macro.abort();
fd.dispose();
if (ij==null)
  parent.dispose();

代码示例来源:origin: imagej/ImageJA

if (name==null)
  Macro.abort();
fd.dispose();
if (ij==null)
  parent.dispose();

代码示例来源:origin: sc.fiji/MTrackJ_

String getsavepath() {
  
  final FileDialog fdg = new FileDialog(this,mtrackj.name()+": Save",FileDialog.SAVE);
  fdg.setDirectory(savedir);
  fdg.setFile(mtrackj.image().getTitle()+".mdf");
  fdg.setVisible(true);
  final String dir = fdg.getDirectory();
  final String file = fdg.getFile();
  fdg.dispose();
  if (dir != null && file != null) {
    savedir = dir;
    if (!mtrackj.settings().separatefolders)
      loaddir = importdir = dir;
    storeFolders();
    return dir+file;
  } else return null;
}

代码示例来源:origin: sc.fiji/FlowJ_

private void doRead()
/*
   Open an external flow field and display.
*/
{
   FileDialog fd = new FileDialog(this.win, "Read flow file...", FileDialog.LOAD);
   if (defaultDirectory!=null)
        fd.setDirectory(defaultDirectory);
   fd.setVisible(true);
   String name = fd.getFile();
   String directory = fd.getDirectory();
   defaultDirectory = directory;
   fd.dispose();
   FlowJFlow newflow = new FlowJFlow();
   ImageStack stack = imp.getStack();
   if (flow.read(directory+name))
   {
      if (flow.getWidth() != stack.getWidth() || flow.getHeight() != stack.getHeight())
      {
         IJ.error("Flow field does not fit this estimator.\nPlease create a new one.");
         return;
      }
      IJ.wait(250);  // give system time to redraw ImageJ window
      description = name;
      fastDisplay();
      IJ.write("Read: "+name);
      flow = newflow;
   }
}
  private void doSave()

代码示例来源:origin: sc.fiji/FlowJ_

String directory = fd.getDirectory();
defaultDirectory = directory;
fd.dispose();

相关文章