本文整理匯總了Java中com.trollworks.toolkit.ui.widget.StdFileDialog.showOpenDialog方法的典型用法代碼示例。如果您正苦於以下問題:Java StdFileDialog.showOpenDialog方法的具體用法?Java StdFileDialog.showOpenDialog怎麽用?Java StdFileDialog.showOpenDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.trollworks.toolkit.ui.widget.StdFileDialog
的用法示例。
在下文中一共展示了StdFileDialog.showOpenDialog方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
示例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);
}
示例3: 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
}
}
}