javax.swing.JFileChooser#setLocation ( )源码实例Demo

下面列出了javax.swing.JFileChooser#setLocation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: megamek   文件: ClientGUI.java
private boolean saveGame() {
    ignoreHotKeys = true;
    JFileChooser fc = new JFileChooser("./savegames");
    fc.setLocation(frame.getLocation().x + 150, frame.getLocation().y + 100);
    fc.setDialogTitle(Messages.getString("ClientGUI.FileSaveDialog.title"));

    int returnVal = fc.showSaveDialog(frame);
    ignoreHotKeys = false;
    if ((returnVal != JFileChooser.APPROVE_OPTION) || (fc.getSelectedFile() == null)) {
        // I want a file, y'know!
        return false;
    }
    if (fc.getSelectedFile() != null) {
        String file = fc.getSelectedFile().getName();
        // stupid hack to allow for savegames in folders with spaces in
        // the name
        String path = fc.getSelectedFile().getParentFile().getPath();
        path = path.replace(" ", "|");
        client.sendChat("/localsave " + file + " " + path); //$NON-NLS-1$
        return true;
    }
    return false;
}
 
源代码2 项目: pdfxtk   文件: Preferences.java
void apply(JFileChooser jfc) {
     jfc.setLocation(location);
     if(selection.length == 1) {
if(selection[0] != null)
  jfc.setSelectedFile(selection[0]);
     } else
jfc.setSelectedFiles(selection);
   }