org.openide.util.Utilities.isMac()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.openide.util.Utilities.isMac()方法的一些代码示例,展示了Utilities.isMac()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.isMac()方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:isMac

Utilities.isMac介绍

[英]Test whether NetBeans is running on Mac OS X.
[中]测试NetBeans是否在Mac OS X上运行。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

private static boolean addModifiersPortable(StringBuilder buf, int modifiers) {
  boolean b = false;
  if ((modifiers & KeyEvent.SHIFT_MASK) != 0) {
    buf.append('S');
    b = true;
  }
  if (Utilities.isMac() && ((modifiers & KeyEvent.META_MASK) != 0) || !Utilities.isMac() && ((modifiers & KeyEvent.CTRL_MASK) != 0)) {
    buf.append('D');
    b = true;
  }
  if (Utilities.isMac() && ((modifiers & KeyEvent.CTRL_MASK) != 0) || !Utilities.isMac() && ((modifiers & KeyEvent.ALT_MASK) != 0)) {
    buf.append('O');
    b = true;
  }
  // mac alt fallback
  if (Utilities.isMac() && ((modifiers & KeyEvent.ALT_MASK) != 0)) {
    buf.append('A');
    b = true;
  }
  // META fallback, see issue #224362
  if (!Utilities.isMac() && ((modifiers & KeyEvent.META_MASK) != 0)) {
    buf.append('M');
    b = true;
  }
  return b;
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

protected OutputStream outputStream(final String name) throws java.io.IOException {
  File f = getFile(name);
  if (!f.exists()) {
    f.getParentFile().mkdirs();
  }
  OutputStream retVal = new BufferedOutputStream(new FileOutputStream(f));
  // workaround for #42624
  if (Utilities.isMac()) {
    retVal = getOutputStreamForMac42624(retVal, name);
  }
  return retVal;
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Creates BufferedImage with Transparency.TRANSLUCENT */
static final java.awt.image.BufferedImage createBufferedImage(int width, int height) {
  if (Utilities.isMac()) {
    return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
  }
  ColorModel model = colorModel(java.awt.Transparency.TRANSLUCENT);
  java.awt.image.BufferedImage buffImage = new java.awt.image.BufferedImage(
      model, model.createCompatibleWritableRaster(width, height), model.isAlphaPremultiplied(), null
    );
  return buffImage;
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** @return size of the screen. The size is modified for Windows OS
 * - some points are subtracted to reflect a presence of the taskbar
 *
 * @deprecated this method is almost useless in multiple monitor configuration
 *
 * @see #getUsableScreenBounds()
 * @see #findCenterBounds(Dimension)
 */
@Deprecated
public static Dimension getScreenSize() {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  if (isWindows() && !Boolean.getBoolean("netbeans.no.taskbar")) {
    screenSize.height -= TYPICAL_WINDOWS_TASKBAR_HEIGHT;
  } else if (isMac()) {
    screenSize.height -= TYPICAL_MACOSX_MENU_HEIGHT;
  }
  return screenSize;
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

if (Utilities.isMac()) {

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private static File normalizeFileImpl(File file) {
  // XXX should use NIO in JDK 7; see #6358641
  Parameters.notNull("file", file);  //NOI18N
  File retFile;
  LOG.log(Level.FINE, "FileUtil.normalizeFile for {0}", file); // NOI18N
  long now = System.currentTimeMillis();
  if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) {
    retFile = normalizeFileOnWindows(file);
  } else if (Utilities.isMac()) {
    retFile = normalizeFileOnMac(file);
  } else {
    retFile = normalizeFileOnUnixAlike(file);
  }
  File ret = (file.getPath().equals(retFile.getPath())) ? file : retFile;
  long took = System.currentTimeMillis() - now;
  if (took > 500) {
    LOG.log(Level.WARNING, "FileUtil.normalizeFile({0}) took {1} ms. Result is {2}", new Object[]{file, took, ret});
  }
  return ret;
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private FileDialog createFileDialog( File currentDirectory ) {
  if( badger != null )
    return null;
  if( !Boolean.getBoolean("nb.native.filechooser") )
    return null;
  if( dirsOnly && !Utilities.isMac() )
    return null;
  Component parentComponent = findDialogParent();
  Frame parentFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
  FileDialog fileDialog = new FileDialog(parentFrame);
  if (title != null) {
    fileDialog.setTitle(title);
  }
  if( null != currentDirectory )
    fileDialog.setDirectory(currentDirectory.getAbsolutePath());
  return fileDialog;
}

代码示例来源:origin: org.netbeans.api/org-openide-util

needed |= getMenuShortcutKeyMask();
if (isMac()) {
  if (!usableKeyOnMac(i, macAlt ? needed | KeyEvent.CTRL_MASK : needed)) {
    needed &= ~getMenuShortcutKeyMask();

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2)) || Utilities.isMac()) {

代码示例来源:origin: org.netbeans.api/org-openide-util

if (isMac()) {
  image = ImageUtilities.loadImage("org/openide/util/progress-cursor-mac.gif"); //NOI18N
} else if (isUnix()) {

代码示例来源:origin: org.netbeans.api/org-openide-awt

/**
 * Workaround for Apple bug 3644261 - after using form editor, all boldface
 * fonts start showing up with incorrect metrics, such that all boldface
 * fonts in the entire IDE are displayed 12px below where they should be.
 * Embarrassing and awful.
 */
private static final Font deriveFont(Font f, int style) {
  //      return f.deriveFont(style);
  // see #49973 for details.
  Font result = Utilities.isMac() ? new Font(f.getName(), style, f.getSize()) : f.deriveFont(style);
  return result;
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

private static Font doDeriveFont(Font original, int style) {
  if (Utilities.isMac()) {
    // don't use deriveFont() - see #49973 for details
    return new Font(original.getName(), style, original.getSize());
  }
  return original.deriveFont(style);
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

private static boolean addModifiersPortable(StringBuilder buf, int modifiers) {
  boolean b = false;
  if ((modifiers & KeyEvent.SHIFT_MASK) != 0) {
    buf.append('S');
    b = true;
  }
  if (Utilities.isMac() && ((modifiers & KeyEvent.META_MASK) != 0) || !Utilities.isMac() && ((modifiers & KeyEvent.CTRL_MASK) != 0)) {
    buf.append('D');
    b = true;
  }
  if (Utilities.isMac() && ((modifiers & KeyEvent.CTRL_MASK) != 0) || !Utilities.isMac() && ((modifiers & KeyEvent.ALT_MASK) != 0)) {
    buf.append('O');
    b = true;
  }
  // mac alt fallback
  if (Utilities.isMac() && ((modifiers & KeyEvent.ALT_MASK) != 0)) {
    buf.append('A');
    b = true;
  }
  // META fallback, see issue #224362
  if (!Utilities.isMac() && ((modifiers & KeyEvent.META_MASK) != 0)) {
    buf.append('M');
    b = true;
  }
  return b;
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

/** Creates BufferedImage with Transparency.TRANSLUCENT */
static final java.awt.image.BufferedImage createBufferedImage(int width, int height) {
  if (Utilities.isMac()) {
    return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
  }
  ColorModel model = colorModel(java.awt.Transparency.TRANSLUCENT);
  java.awt.image.BufferedImage buffImage = new java.awt.image.BufferedImage(
      model, model.createCompatibleWritableRaster(width, height), model.isAlphaPremultiplied(), null
    );
  return buffImage;
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

/** @return size of the screen. The size is modified for Windows OS
 * - some points are subtracted to reflect a presence of the taskbar
 *
 * @deprecated this method is almost useless in multiple monitor configuration
 *
 * @see #getUsableScreenBounds()
 * @see #findCenterBounds(Dimension)
 */
@Deprecated
public static Dimension getScreenSize() {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  if (isWindows() && !Boolean.getBoolean("netbeans.no.taskbar")) {
    screenSize.height -= TYPICAL_WINDOWS_TASKBAR_HEIGHT;
  } else if (isMac()) {
    screenSize.height -= TYPICAL_MACOSX_MENU_HEIGHT;
  }
  return screenSize;
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

if (Utilities.isMac()) {
        chars[estCharsToPaint-1] = '…';
      int  newWidth;
      if (Utilities.isMac()) {

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

case NotifyDescriptor.DEFAULT_OPTION:
case NotifyDescriptor.OK_CANCEL_OPTION:
  if (!Utilities.isMac()) {
  if (!Utilities.isMac()) {
  if (!Utilities.isMac()) {

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

needed |= getMenuShortcutKeyMask();
if (isMac()) {
  if (!usableKeyOnMac(i, macAlt ? needed | KeyEvent.CTRL_MASK : needed)) {
    needed &= ~getMenuShortcutKeyMask();

代码示例来源:origin: org.netbeans.api/org-openide-awt

if (Utilities.isMac()) {
      if (Utilities.isMac()) {
          if (Utilities.isMac()) {

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

if (isMac()) {
  image = ImageUtilities.loadImage("org/openide/util/progress-cursor-mac.gif"); //NOI18N
} else if (isUnix()) {

相关文章

微信公众号

最新文章

更多