本文整理匯總了Java中com.trollworks.toolkit.utility.Platform.isMacintosh方法的典型用法代碼示例。如果您正苦於以下問題:Java Platform.isMacintosh方法的具體用法?Java Platform.isMacintosh怎麽用?Java Platform.isMacintosh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.trollworks.toolkit.utility.Platform
的用法示例。
在下文中一共展示了Platform.isMacintosh方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createMenu
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public JMenu createMenu() {
JMenu menu = new JMenu(HELP);
menu.setName(NAME);
if (!Platform.isMacintosh()) {
menu.add(new JMenuItem(AboutCommand.INSTANCE));
menu.addSeparator();
}
menu.add(new JMenuItem(UpdateCommand.INSTANCE));
menu.addSeparator();
menu.add(new JMenuItem(new OpenURICommand(RELEASE_NOTES, GCSApp.WEB_SITE + "/release_notes.html"))); //$NON-NLS-1$
menu.add(new JMenuItem(new OpenURICommand(LICENSE, App.getHomePath().resolve("license.html").toUri()))); //$NON-NLS-1$
menu.addSeparator();
menu.add(new JMenuItem(new OpenURICommand(WEB_SITE, GCSApp.WEB_SITE)));
menu.add(new JMenuItem(new OpenURICommand(MAILING_LISTS, GCSApp.WEB_SITE + "/mailing_lists.html"))); //$NON-NLS-1$
menu.add(new JMenuItem(new OpenURICommand(FEATURE_REQUESTS, "https://gurpscharactersheet.atlassian.net/issues/?filter=10000"))); //$NON-NLS-1$
menu.add(new JMenuItem(new OpenURICommand(BUG_REPORTS, "https://gurpscharactersheet.atlassian.net/issues/?filter=10001"))); //$NON-NLS-1$
DynamicMenuEnabler.add(menu);
return menu;
}
示例2: getModifiableCommands
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public Set<Command> getModifiableCommands() {
Set<Command> cmds = new HashSet<>();
cmds.add(NewCharacterSheetCommand.INSTANCE);
cmds.add(NewCharacterTemplateCommand.INSTANCE);
cmds.add(NewAdvantagesLibraryCommand.INSTANCE);
cmds.add(NewEquipmentLibraryCommand.INSTANCE);
cmds.add(NewNoteLibraryCommand.INSTANCE);
cmds.add(NewSkillsLibraryCommand.INSTANCE);
cmds.add(NewSpellsLibraryCommand.INSTANCE);
cmds.add(OpenCommand.INSTANCE);
cmds.add(CloseCommand.INSTANCE);
cmds.add(SaveCommand.INSTANCE);
cmds.add(SaveAsCommand.INSTANCE);
cmds.add(ExportToGurpsCalculatorCommand.INSTANCE);
cmds.add(PageSetupCommand.INSTANCE);
cmds.add(PrintCommand.INSTANCE);
if (!Platform.isMacintosh()) {
cmds.add(QuitCommand.INSTANCE);
}
return cmds;
}
示例3: addRecent
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/** @param file The {@link File} to add to the recents list. */
public static void addRecent(File file) {
String extension = PathUtils.getExtension(file.getName());
if (Platform.isMacintosh() || Platform.isWindows()) {
extension = extension.toLowerCase();
}
for (String allowed : FileType.getOpenableExtensions()) {
if (allowed.equals(extension)) {
if (file.canRead()) {
file = PathUtils.getFile(PathUtils.getFullPath(file));
RECENTS.remove(file);
RECENTS.add(0, file);
if (RECENTS.size() > MAX_RECENTS) {
RECENTS.remove(MAX_RECENTS);
}
}
break;
}
}
}
示例4: createMenu
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public JMenu createMenu() {
JMenu menu = new JMenu("Edit"); //$NON-NLS-1$
menu.add(new DynamicMenuItem(UndoCommand.INSTANCE));
menu.add(new DynamicMenuItem(RedoCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(CutCommand.INSTANCE));
menu.add(new DynamicMenuItem(CopyCommand.INSTANCE));
menu.add(new DynamicMenuItem(PasteCommand.INSTANCE));
menu.add(new DynamicMenuItem(DuplicateCommand.INSTANCE));
menu.add(new DynamicMenuItem(DeleteCommand.INSTANCE));
menu.add(new DynamicMenuItem(SelectAllCommand.INSTANCE));
if (!Platform.isMacintosh()) {
menu.addSeparator();
menu.add(new DynamicMenuItem(PreferencesCommand.INSTANCE));
}
DynamicMenuEnabler.add(menu);
return menu;
}
示例5: finalStartup
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的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: getModifiableCommands
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public Set<Command> getModifiableCommands() {
Set<Command> cmds = new HashSet<>();
cmds.add(UndoCommand.INSTANCE);
cmds.add(RedoCommand.INSTANCE);
cmds.add(CutCommand.INSTANCE);
cmds.add(CopyCommand.INSTANCE);
cmds.add(PasteCommand.INSTANCE);
cmds.add(DuplicateCommand.INSTANCE);
cmds.add(DeleteCommand.INSTANCE);
cmds.add(SelectAllCommand.INSTANCE);
cmds.add(IncrementCommand.INSTANCE);
cmds.add(DecrementCommand.INSTANCE);
cmds.add(SkillLevelIncrementCommand.INSTANCE);
cmds.add(SkillLevelDecrementCommand.INSTANCE);
cmds.add(TechLevelIncrementCommand.INSTANCE);
cmds.add(TechLevelDecrementCommand.INSTANCE);
cmds.add(RotateStateCommand.INSTANCE);
cmds.add(JumpToSearchCommand.INSTANCE);
cmds.add(RandomizeDescriptionCommand.INSTANCE);
cmds.add(RandomizeNameCommand.FEMALE_INSTANCE);
cmds.add(RandomizeNameCommand.MALE_INSTANCE);
cmds.add(AddNaturalPunchCommand.INSTANCE);
cmds.add(AddNaturalKickCommand.INSTANCE);
cmds.add(AddNaturalKickWithBootsCommand.INSTANCE);
cmds.add(SwapDefaultsCommand.INSTANCE);
if (!Platform.isMacintosh()) {
cmds.add(PreferencesCommand.INSTANCE);
}
return cmds;
}
示例7: createMenu
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public JMenu createMenu() {
JMenu menu = new JMenu(EDIT);
menu.setName(NAME);
menu.add(new DynamicMenuItem(UndoCommand.INSTANCE));
menu.add(new DynamicMenuItem(RedoCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(CutCommand.INSTANCE));
menu.add(new DynamicMenuItem(CopyCommand.INSTANCE));
menu.add(new DynamicMenuItem(PasteCommand.INSTANCE));
menu.add(new DynamicMenuItem(DuplicateCommand.INSTANCE));
menu.add(new DynamicMenuItem(DeleteCommand.INSTANCE));
menu.add(new DynamicMenuItem(SelectAllCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(IncrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(DecrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(SkillLevelIncrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(SkillLevelDecrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(TechLevelIncrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(TechLevelDecrementCommand.INSTANCE));
menu.add(new DynamicMenuItem(RotateStateCommand.INSTANCE));
menu.add(new DynamicMenuItem(SwapDefaultsCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(JumpToSearchCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(RandomizeDescriptionCommand.INSTANCE));
menu.add(new DynamicMenuItem(RandomizeNameCommand.FEMALE_INSTANCE));
menu.add(new DynamicMenuItem(RandomizeNameCommand.MALE_INSTANCE));
menu.addSeparator();
menu.add(new DynamicCheckBoxMenuItem(AddNaturalPunchCommand.INSTANCE));
menu.add(new DynamicCheckBoxMenuItem(AddNaturalKickCommand.INSTANCE));
menu.add(new DynamicCheckBoxMenuItem(AddNaturalKickWithBootsCommand.INSTANCE));
menu.addSeparator();
if (!Platform.isMacintosh()) {
menu.add(new DynamicMenuItem(PreferencesCommand.INSTANCE));
}
menu.add(createLanguageMenu());
DynamicMenuEnabler.add(menu);
return menu;
}
示例8: createMenu
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
@Override
public JMenu createMenu() {
JMenu menu = new JMenu(FILE);
menu.setName(NAME);
menu.add(new DynamicMenuItem(NewCharacterSheetCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewCharacterTemplateCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewAdvantagesLibraryCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewEquipmentLibraryCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewNoteLibraryCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewSkillsLibraryCommand.INSTANCE));
menu.add(new DynamicMenuItem(NewSpellsLibraryCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(OpenCommand.INSTANCE));
menu.add(new RecentFilesMenu());
menu.add(new DynamicMenuItem(CloseCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(SaveCommand.INSTANCE));
menu.add(new DynamicMenuItem(SaveAsCommand.INSTANCE));
menu.add(new DynamicMenuItem(ExportToGurpsCalculatorCommand.INSTANCE));
menu.addSeparator();
menu.add(new DynamicMenuItem(PageSetupCommand.INSTANCE));
menu.add(new DynamicMenuItem(PrintCommand.INSTANCE));
if (!Platform.isMacintosh()) {
menu.addSeparator();
menu.add(new DynamicMenuItem(QuitCommand.INSTANCE));
}
DynamicMenuEnabler.add(menu);
return menu;
}
示例9: getMaximumWindowBounds
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/**
* Determines the screen that most contains the specified global bounds and returns the maximum
* size a window can be on that screen.
*
* @param bounds The global bounds to use when determining the maximum bounds for a window.
* @return The maximum bounds that fits on a screen.
*/
public static Rectangle getMaximumWindowBounds(Rectangle bounds) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = getPreferredScreenDevice(bounds);
if (gd == ge.getDefaultScreenDevice()) {
bounds = ge.getMaximumWindowBounds();
// The Mac (and now Windows as of Java 5) already return the correct
// value... try to fix it up for the other platforms. This doesn't
// currently work, either, since the other platforms seem to always
// return empty insets.
if (!Platform.isMacintosh() && !Platform.isWindows()) {
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gd.getDefaultConfiguration());
// Since this is failing to do the right thing anyway, we're going
// to try and come up with some reasonable limitations...
if (insets.top == 0 && insets.bottom == 0) {
insets.bottom = 48;
}
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
}
return bounds;
}
return gd.getDefaultConfiguration().getBounds();
}
示例10: forceAppToFront
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/** Attempts to force the app to the front. */
public static void forceAppToFront() {
if (Platform.isMacintosh()) {
Application.getApplication().requestForeground(true);
} else if (OK_TO_USE_FULLSCREEN_TRICK) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
AppWindow window = new AppWindow();
window.setUndecorated(true);
window.getContentPane().setBackground(new Color(0, 0, 0, 0));
gd.setFullScreenWindow(window);
gd.setFullScreenWindow(null);
window.dispose();
}
}
示例11: App
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/** Creates a new {@link App}. */
protected App() {
if (Platform.isMacintosh()) {
Application app = Application.getApplication();
app.setAboutHandler(AboutCommand.INSTANCE);
app.setPreferencesHandler(PreferencesCommand.INSTANCE);
app.setOpenFileHandler(OpenCommand.INSTANCE);
app.setPrintFileHandler(PrintCommand.INSTANCE);
app.setQuitHandler(QuitCommand.INSTANCE);
app.setQuitStrategy(QuitStrategy.SYSTEM_EXIT_0);
app.disableSuddenTermination();
}
}
示例12: getKeyStrokeDisplay
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/**
* @param ks The {@link KeyStroke} to use.
* @return The text that represents the {@link KeyStroke}.
*/
public static String getKeyStrokeDisplay(KeyStroke ks) {
StringBuilder buffer = new StringBuilder();
if (ks != null) {
int modifiers = ks.getModifiers();
if (modifiers > 0) {
String modifierText = KeyEvent.getKeyModifiersText(modifiers);
if (Platform.isMacintosh()) {
buffer.append(modifierText.replaceAll("\\+", "")); //$NON-NLS-1$ //$NON-NLS-2$
} else {
buffer.append(modifierText);
String delimiter = UIManager.getString("MenuItem.acceleratorDelimiter"); //$NON-NLS-1$
if (delimiter == null) {
delimiter = "+"; //$NON-NLS-1$
}
buffer.append(delimiter);
}
}
int keyCode = ks.getKeyCode();
if (keyCode != 0) {
buffer.append(KeyEvent.getKeyText(keyCode));
} else {
buffer.append(ks.getKeyChar());
}
}
return buffer.toString();
}
示例13: createExtensionMatcher
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/**
* Convenience for creating a regular expression that will match a file extension. This takes
* care of turning on case-insensitivity for those platforms that need it.
*
* @param extension A file name extension.
* @return The regular expression that will match the specified file name extension.
*/
public static String createExtensionMatcher(String extension) {
StringBuilder builder = new StringBuilder();
if (Platform.isMacintosh() || Platform.isWindows()) {
builder.append("(?i)"); //$NON-NLS-1$
}
builder.append("^.*\\"); //$NON-NLS-1$
if (!extension.startsWith(".")) { //$NON-NLS-1$
builder.append('.');
}
builder.append(extension);
builder.append('$');
return builder.toString();
}
示例14: QuitCommand
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
private QuitCommand() {
super(Platform.isMacintosh() ? QUIT : EXIT, CMD_QUIT, KeyEvent.VK_Q);
}
示例15: setDefaultMenuBar
import com.trollworks.toolkit.utility.Platform; //導入方法依賴的package包/類
/** Set a global menu bar for when no windows are open / focused. */
public static void setDefaultMenuBar(JMenuBar menuBar) {
if (Platform.isMacintosh()) {
Application.getApplication().setDefaultMenuBar(menuBar);
}
}