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

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

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

FileDialog.setTitle介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private FileDialog createFileDialog( File currentDirectory ) {
  if( badger != null )
    return null;
  if( !Boolean.getBoolean("nb.native.filechooser") )
    return null;
  if( dirsOnly && !Utilities.isMac() )
    return null;
  Component parentComponent = findDialogParent();
  Frame parentFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
  FileDialog fileDialog = new FileDialog(parentFrame);
  if (title != null) {
    fileDialog.setTitle(title);
  }
  if( null != currentDirectory )
    fileDialog.setDirectory(currentDirectory.getAbsolutePath());
  return fileDialog;
}

代码示例来源:origin: redwarp/9-Patch-Resizer

fileDialog.setTitle(Localization.get("image_types"));

代码示例来源:origin: stackoverflow.com

FileDialog fd = new FileDialog(FdExample.this, "select File", FileDialog.LOAD);
fd.setTitle("any new title");

代码示例来源:origin: sarahtattersall/PIPE

/**
 * @param temporary path to copy to new location
 * @param message   displayed message in save file dialog pop up
 */
private void copyFile(Path temporary, String message) {
  loadDialog.setMode(FileDialog.SAVE);
  loadDialog.setTitle(message);
  loadDialog.setVisible(true);
  File[] files = loadDialog.getFiles();
  if (files.length > 0) {
    File file = files[0];
    Path path = Paths.get(file.toURI());
    try {
      Files.copy(temporary, path, StandardCopyOption.REPLACE_EXISTING);
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, e.getMessage());
    }
  }
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Loads the transition and state binary files into the member variables
 */
private void loadBinaryFiles() {
  loadDialog.setMode(FileDialog.LOAD);
  loadDialog.setTitle("Load transitions file");
  loadDialog.setVisible(true);
  File[] files = loadDialog.getFiles();
  if (files.length > 0) {
    File file = files[0];
    binaryTransitions = Paths.get(file.toURI());
    transitionFieldLabel.setText(file.getName());
  } else {
    return;
  }
  loadDialog.setTitle("Load states file");
  loadDialog.setVisible(true);
  File[] statesFiles = loadDialog.getFiles();
  if (statesFiles.length > 0) {
    File file = statesFiles[0];
    binaryStates = Paths.get(file.toURI());
    stateFieldLabel.setText(file.getName());
  } else {
    LOGGER.log(Level.INFO, "No file loaded");
  }
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Opens the file dialog and saves the selected Petri net into lastLoadedPetriNet
 * for use when calculating the state space exploration
 */
private void loadData() {
  loadDialog.setMode(FileDialog.LOAD);
  loadDialog.setTitle("Select petri net");
  loadDialog.setVisible(true);
  File[] files = loadDialog.getFiles();
  if (files.length > 0) {
    File path = files[0];
    try {
      petriNetNameLabel.setText(path.getName());
      PetriNetReader petriNetIO = new PetriNetIOImpl();
      lastLoadedPetriNet = petriNetIO.read(path.getAbsolutePath());
    } catch (JAXBException | FileNotFoundException e) {
      LOGGER.log(Level.SEVERE, e.getMessage());
    }
  }
}

代码示例来源:origin: Audiveris/audiveris

fd.setTitle(title);
fd.setVisible(true);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils

private FileDialog createFileDialog(Component parentComponent, File currentDirectory) {
  boolean dirsOnly = getFileSelectionMode() == DIRECTORIES_ONLY;
  if (!Boolean.getBoolean("nb.native.filechooser")) { //NOI18N
    return null;
  }
  if (dirsOnly && !Utilities.isMac()) {
    return null;
  }
  Frame parentFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
  FileDialog fileDialog = new FileDialog(parentFrame);
  String dialogTitle = getDialogTitle();
  if (dialogTitle != null) {
    fileDialog.setTitle(dialogTitle);
  }
  if (null != currentDirectory) {
    fileDialog.setDirectory(currentDirectory.getAbsolutePath());
  }
  return fileDialog;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils-ui

private FileDialog createFileDialog(Component parentComponent, File currentDirectory) {
  boolean dirsOnly = getFileSelectionMode() == DIRECTORIES_ONLY;
  if (!Boolean.getBoolean("nb.native.filechooser")) { //NOI18N
    return null;
  }
  if (dirsOnly && !Utilities.isMac()) {
    return null;
  }
  Frame parentFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
  FileDialog fileDialog = new FileDialog(parentFrame);
  String dialogTitle = getDialogTitle();
  if (dialogTitle != null) {
    fileDialog.setTitle(dialogTitle);
  }
  if (null != currentDirectory) {
    fileDialog.setDirectory(currentDirectory.getAbsolutePath());
  }
  return fileDialog;
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

dialog.setTitle ("Save");
dialog.setDirectory (mHomeDir);        
dialog.setVisible (true);

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
 * The action to take when "Open" menu or button pressed.
 */
protected void openAction ()
{
  FileDialog dialog;
  File file;
  dialog = new FileDialog (this);
  dialog.setMode (FileDialog.LOAD);
  dialog.setTitle ("Open");
  dialog.setDirectory (mHomeDir);
  dialog.setVisible (true);
  if (null != dialog.getFile ())
  {
    mHomeDir = dialog.getDirectory ();
    file = new File (mHomeDir + dialog.getFile ());
    open (file.getAbsolutePath ());
    setTitle (TITLE + " - " + file.getAbsolutePath ());
  }
}

相关文章