本文整理汇总了Java中com.trollworks.toolkit.ui.widget.WindowUtils类的典型用法代码示例。如果您正苦于以下问题:Java WindowUtils类的具体用法?Java WindowUtils怎么用?Java WindowUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WindowUtils类属于com.trollworks.toolkit.ui.widget包,在下文中一共展示了WindowUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的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: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
Locale locale = Localization.getLocaleOverride();
if (!matches(locale)) {
File file = Localization.getLocaleOverrideFile();
if (mLocale == null) {
file.delete();
} else {
try (PrintWriter out = new PrintWriter(file)) {
out.println(mLocale.getLanguage());
} catch (Exception ex) {
// Ignore
}
}
WindowUtils.showWarning(null, NOTICE);
}
}
示例3: pageSetup
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
/**
* Presents the page setup dialog and allows the user to change the settings.
*
* @param proxy The {@link PrintProxy} representing the information that would be printed.
* @return Whether the user canceled (or an error occurred).
*/
public boolean pageSetup(PrintProxy proxy) {
if (useNativeDialogs()) {
PageFormat format = mJob.pageDialog(createPageFormat());
if (format != null) {
adjustSettingsToPageFormat(format);
proxy.adjustToPageSetupChanges();
return true;
}
} else {
PageSetupPanel panel = new PageSetupPanel(getPrintService(), mSet);
if (WindowUtils.showOptionDialog(UIUtilities.getComponentForDialog(proxy), panel, PAGE_SETUP_TITLE, false, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null) == JOptionPane.OK_OPTION) {
try {
PrintService service = panel.accept(mSet);
if (service != null) {
mJob.setPrintService(service);
}
proxy.adjustToPageSetupChanges();
return true;
} catch (PrinterException exception) {
WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), UNABLE_TO_SWITCH_PRINTERS);
}
}
}
return false;
}
示例4: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
JButton button = (JButton) event.getSource();
Command command = mMap.get(button);
KeyStrokeDisplay ksd = new KeyStrokeDisplay(command.getAccelerator());
switch (WindowUtils.showOptionDialog(this, ksd, TYPE_KEYSTROKE, false, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[] { ACCEPT, CLEAR, RESET }, null)) {
case JOptionPane.CLOSED_OPTION:
default:
break;
case JOptionPane.YES_OPTION: // Accept
setAccelerator(button, ksd.getKeyStroke());
break;
case JOptionPane.NO_OPTION: // Clear
setAccelerator(button, null);
break;
case JOptionPane.CANCEL_OPTION: // Reset
setAccelerator(button, command.getOriginalAccelerator());
break;
}
mPanel.setSize(mPanel.getPreferredSize());
adjustResetButton();
}
示例5: finalStartup
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void finalStartup() {
super.finalStartup();
setDefaultMenuBar(new StdMenuBar());
if (Platform.isMacintosh() && App.getHomePath().toString().toLowerCase().contains("/apptranslocation/")) { //$NON-NLS-1$
WindowUtils.showError(null, Text.wrapToCharacterCount(TRANSLOCATION_INSTRUCTIONS, 60) + XATTR_CMD);
}
}
示例6: saveTo
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public File[] saveTo(File file) {
ArrayList<File> result = new ArrayList<>();
String extension = PathUtils.getExtension(file.getName());
File textTemplate = TextTemplate.resolveTextTemplate(null);
String templateExtension = PathUtils.getExtension(textTemplate.getName());
if (FileType.PNG_EXTENSION.equals(extension)) {
if (!mSheet.saveAsPNG(file, result)) {
WindowUtils.showError(this, EXPORT_PNG_ERROR);
}
} else if (FileType.PDF_EXTENSION.equals(extension)) {
if (mSheet.saveAsPDF(file)) {
result.add(file);
} else {
WindowUtils.showError(this, EXPORT_PDF_ERROR);
}
} else if (templateExtension.equals(extension)) {
if (new TextTemplate(mSheet).export(file, null)) {
result.add(file);
} else {
WindowUtils.showError(this, EXPORT_TEXT_TEMPLATE_ERROR);
}
} else {
return super.saveTo(file);
}
return result.toArray(new File[result.size()]);
}
示例7: choosePortrait
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
/** Allows the user to choose a portrait for their character. */
public void choosePortrait() {
File file = SheetPreferences.choosePortrait();
if (file != null) {
try {
mSheet.getCharacter().getDescription().setPortrait(StdImage.loadImage(file));
} catch (Exception exception) {
WindowUtils.showError(this, MessageFormat.format(BAD_IMAGE, PathUtils.getFullPath(file)));
}
}
}
示例8: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
CharacterSheet target = getTarget(CharacterSheet.class);
if (target != null) {
DescriptionRandomizer panel = new DescriptionRandomizer(target.getCharacter());
if (WindowUtils.showOptionDialog(null, panel, RANDOMIZER, true, JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, GCSImages.getCharacterSheetDocumentIcons().getImage(32), new String[] { APPLY, CANCEL }, APPLY) == JOptionPane.OK_OPTION) {
panel.applyChanges();
}
}
}
示例9: saveTo
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public File[] saveTo(File file) {
if (mDataFile.save(file)) {
mDataFile.setFile(file);
getDockContainer().updateTitle(this);
return new File[] { file };
}
WindowUtils.showError(this, SAVE_ERROR);
return new File[0];
}
示例10: rebuild
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
private void rebuild(PrintService service, PrintRequestAttributeSet set) {
removeAll();
mService = service;
createPrinterCombo();
rebuildSelf(set);
revalidate();
Window window = WindowUtils.getWindowForComponent(this);
if (window != null) {
window.setSize(window.getPreferredSize());
GraphicsUtilities.forceOnScreen(window);
}
}
示例11: goToUpdate
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
/** Go to the update location on the web, if a new version is available. */
public static void goToUpdate() {
if (NEW_VERSION_AVAILABLE && Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(UPDATE_URL));
} catch (Exception exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
}
示例12: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
try {
Desktop.getDesktop().open(mFile);
} catch (IOException exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
示例13: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (mURI != null) {
try {
Desktop.getDesktop().browse(mURI);
} catch (IOException exception) {
WindowUtils.showError(null, exception.getMessage());
}
}
}
示例14: print
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
/** @param proxy The {@link PrintProxy} to print. */
public static void print(PrintProxy proxy) {
if (proxy != null) {
PrintManager mgr = proxy.getPrintManager();
if (mgr != null) {
mgr.print(proxy);
} else {
WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_SELECTED);
}
}
}
示例15: actionPerformed
import com.trollworks.toolkit.ui.widget.WindowUtils; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
PrintProxy proxy = getTarget(PrintProxy.class);
if (proxy != null) {
PrintManager mgr = proxy.getPrintManager();
if (mgr != null) {
mgr.pageSetup(proxy);
} else {
WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_SELECTED);
}
}
}