当前位置: 首页>>代码示例>>Java>>正文


Java StdFileDialog类代码示例

本文整理汇总了Java中com.trollworks.toolkit.ui.widget.StdFileDialog的典型用法代码示例。如果您正苦于以下问题:Java StdFileDialog类的具体用法?Java StdFileDialog怎么用?Java StdFileDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StdFileDialog类属于com.trollworks.toolkit.ui.widget包,在下文中一共展示了StdFileDialog类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if (source == mPNGResolutionCombo) {
        Preferences.getInstance().setValue(MODULE, PNG_RESOLUTION_KEY, DPI[mPNGResolutionCombo.getSelectedIndex()]);
    } else if (source == mTextTemplatePicker) {
        File file = StdFileDialog.showOpenDialog(this, SELECT_TEXT_TEMPLATE);
        if (file != null) {
            mTextTemplatePath.setText(PathUtils.getFullPath(file));
        }
    } else if (source == mGurpsCalculatorLink && Desktop.isDesktopSupported()) {
        try {
            Desktop.getDesktop().browse(new URI(GURPS_CALCULATOR_URL));
        } catch (Exception exception) {
            WindowUtils.showError(this, MessageFormat.format(UNABLE_TO_OPEN_URL, GURPS_CALCULATOR_URL));
        }
    }
    adjustResetButton();
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:20,代码来源:OutputPreferences.java

示例2: choosePortrait

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
public static File choosePortrait() {
    List<FileNameExtensionFilter> filters = new ArrayList<>();
    filters.add(new FileNameExtensionFilter(ALL_READABLE_IMAGE_FILES, FileType.PNG_EXTENSION, FileType.JPEG_EXTENSION, "jpeg", FileType.GIF_EXTENSION)); //$NON-NLS-1$
    filters.add(FileType.getPngFilter());
    filters.add(FileType.getJpegFilter());
    filters.add(FileType.getGifFilter());
    return StdFileDialog.showOpenDialog(null, SELECT_PORTRAIT, filters);
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:9,代码来源:SheetPreferences.java

示例3: saveAs

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
/**
 * Allows the user to save the file under another name.
 *
 * @param saveable The {@link Saveable} to work on.
 * @return The file(s) actually written to. May be empty.
 */
public static File[] saveAs(Saveable saveable) {
	if (saveable == null) {
		return new File[0];
	}
	String path = saveable.getPreferredSavePath();
	File result = StdFileDialog.choose(UIUtilities.getComponentForDialog(saveable), false, SAVE_AS, PathUtils.getParent(path), PathUtils.getLeafName(path), saveable.getAllowedExtensions());
	File[] files = result != null ? saveable.saveTo(result) : new File[0];
	for (File file : files) {
		RecentFilesMenu.addRecent(file);
	}
	return files;
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:19,代码来源:SaveAsCommand.java

示例4: saveAs

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
/**
 * Allows the user to save the file under another name.
 *
 * @param saveable The {@link Saveable} to work on.
 * @return The file(s) actually written to.
 */
public File[] saveAs(Saveable saveable) {
	if (saveable == null) {
		return new File[0];
	}
	String path = saveable.getPreferredSavePath();
	File result = StdFileDialog.choose(saveable instanceof Component ? (Component) saveable : null, false, (String) getValue(NAME), PathUtils.getParent(path), PathUtils.getLeafName(path), mExtension);
	return result != null ? saveable.saveTo(result) : new File[0];
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:15,代码来源:ExportToCommand.java

示例5: open

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
/** @param file The file to open. */
public static void open(File file) {
	if (file != null) {
		try {
			String name = file.getName();
			FileProxy proxy = AppWindow.findFileProxy(file);
			if (proxy == null) {
				for (FileType type : FileType.getOpenable()) {
					if (name.matches(StdFileDialog.createExtensionMatcher(type.getExtension()))) {
						proxy = type.getFileProxyCreator().create(file);
						break;
					}
				}
			} else {
				proxy.toFrontAndFocus();
			}
			if (proxy != null) {
				RecentFilesMenu.addRecent(file);
			} else {
				throw new IOException("Unknown file extension"); //$NON-NLS-1$
			}
		} catch (Exception exception) {
			Log.error(exception);
			StdFileDialog.showCannotOpenMsg(getFocusOwner(), file.getName(), exception);
		}
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:28,代码来源:OpenCommand.java

示例6: openReference

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
public static void openReference(String reference, String highlight) {
    int i = reference.length() - 1;
    while (i >= 0) {
        char ch = reference.charAt(i);
        if (ch >= '0' && ch <= '9') {
            i--;
        } else {
            i++;
            break;
        }
    }
    if (i > 0) {
        String id = reference.substring(0, i);
        try {
            int page = Integer.parseInt(reference.substring(i));
            PdfRef ref = PdfRef.lookup(id, true);
            if (ref == null) {
                File file = StdFileDialog.showOpenDialog(getFocusOwner(), String.format(LOCATE_PDF, id), new FileNameExtensionFilter(PDF_FILE, FileType.PDF_EXTENSION));
                if (file != null) {
                    ref = new PdfRef(id, file, 0);
                    ref.save();
                }
            }
            if (ref != null) {
                Path path = ref.getFile().toPath();
                LibraryExplorerDockable library = LibraryExplorerDockable.get();
                PdfDockable dockable = (PdfDockable) library.getDockableFor(path);
                if (dockable != null) {
                    dockable.goToPage(ref, page, highlight);
                    dockable.getDockContainer().setCurrentDockable(dockable);
                } else {
                    dockable = new PdfDockable(ref, page, highlight);
                    library.dockPdf(dockable);
                    library.open(path);
                }
            }
        } catch (NumberFormatException nfex) {
            // Ignore
        }
    }
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:42,代码来源:OpenPageReferenceCommand.java

示例7: open

import com.trollworks.toolkit.ui.widget.StdFileDialog; //导入依赖的package包/类
public FileProxy open(Path path) {
    // See if it is already open
    FileProxy proxy = (FileProxy) getDockableFor(path);
    if (proxy == null) {
        // If it wasn't, load it and put it into the dock
        try {
            switch (PathUtils.getExtension(path)) {
                case AdvantageList.EXTENSION:
                    proxy = openAdvantageList(path);
                    break;
                case EquipmentList.EXTENSION:
                    proxy = openEquipmentList(path);
                    break;
                case SkillList.EXTENSION:
                    proxy = openSkillList(path);
                    break;
                case SpellList.EXTENSION:
                    proxy = openSpellList(path);
                    break;
                case LibraryFile.EXTENSION:
                    proxy = openLibrary(path);
                    break;
                case GURPSCharacter.EXTENSION:
                    proxy = dockSheet(new SheetDockable(new GURPSCharacter(path.toFile())));
                    break;
                case Template.EXTENSION:
                    proxy = dockTemplate(new TemplateDockable(new Template(path.toFile())));
                    break;
                case FileType.PDF_EXTENSION:
                    proxy = dockPdf(new PdfDockable(new PdfRef(null, path.toFile(), 0), 1, null));
                    break;
                default:
                    break;
            }
        } catch (Throwable throwable) {
            StdFileDialog.showCannotOpenMsg(this, PathUtils.getLeafName(path, true), throwable);
            proxy = null;
        }
    } else {
        Dockable dockable = (Dockable) proxy;
        dockable.getDockContainer().setCurrentDockable(dockable);
    }
    if (proxy != null) {
        File file = proxy.getBackingFile();
        if (file != null) {
            RecentFilesMenu.addRecent(file);
        }
    }
    return proxy;
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:51,代码来源:LibraryExplorerDockable.java


注:本文中的com.trollworks.toolkit.ui.widget.StdFileDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。