コード例 #1
0
  /**
   * The following code is a trick! By default Swing uses lightweight and "medium" weight popups to
   * show JPopupMenu. The code below force the creation of real heavyweight menus - this increases
   * speed of popups and allows to get rid of some drawing artifacts.
   */
  private static void fixPopupWeight() {
    int popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
    String property = System.getProperty("idea.popup.weight");
    if (property != null) property = property.toLowerCase(Locale.ENGLISH).trim();
    if (SystemInfo.isMacOSLeopard) {
      // force heavy weight popups under Leopard, otherwise they don't have shadow or any kind of
      // border.
      popupWeight = OurPopupFactory.WEIGHT_HEAVY;
    } else if (property == null) {
      // use defaults if popup weight isn't specified
      if (SystemInfo.isWindows) {
        popupWeight = OurPopupFactory.WEIGHT_HEAVY;
      }
    } else {
      if ("light".equals(property)) {
        popupWeight = OurPopupFactory.WEIGHT_LIGHT;
      } else if ("medium".equals(property)) {
        popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
      } else if ("heavy".equals(property)) {
        popupWeight = OurPopupFactory.WEIGHT_HEAVY;
      } else {
        LOG.error("Illegal value of property \"idea.popup.weight\": " + property);
      }
    }

    PopupFactory factory = PopupFactory.getSharedInstance();
    if (!(factory instanceof OurPopupFactory)) {
      factory = new OurPopupFactory(factory);
      PopupFactory.setSharedInstance(factory);
    }
    PopupUtil.setPopupType(factory, popupWeight);
  }
コード例 #2
0
 // TODO[neuro]: move to UIUtil
 public static boolean isRemoteDesktopConnected() {
   if (System.getProperty("os.name").contains("Windows")) {
     final Map map = (Map) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints");
     return map != null
         && RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT.equals(
             map.get(RenderingHints.KEY_TEXT_ANTIALIASING));
   }
   return false;
 }