當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractPainter類代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.AbstractPainter的典型用法代碼示例。如果您正苦於以下問題:Java AbstractPainter類的具體用法?Java AbstractPainter怎麽用?Java AbstractPainter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractPainter類屬於com.intellij.openapi.ui包,在下文中一共展示了AbstractPainter類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initFramePainters

import com.intellij.openapi.ui.AbstractPainter; //導入依賴的package包/類
public static void initFramePainters(@NotNull PaintersHelper painters) {
  PaintersHelper.initWallpaperPainter("idea.wallpaper.ide", painters);

  ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  String path = UIUtil.isUnderDarcula()? appInfo.getEditorBackgroundImageUrl() : null;
  URL url = path == null ? null : appInfo.getClass().getResource(path);
  Image centerImage = url == null ? null : ImageLoader.loadFromUrl(url);

  if (centerImage != null) {
    painters.addPainter(PaintersHelper.newImagePainter(centerImage, PaintersHelper.FillType.TOP_CENTER, 1.0f, JBUI.insets(10, 0, 0, 0)), null);
  }
  painters.addPainter(new AbstractPainter() {
    EditorEmptyTextPainter p = ServiceManager.getService(EditorEmptyTextPainter.class);

    @Override
    public boolean needsRepaint() {
      return true;
    }

    @Override
    public void executePaint(Component component, Graphics2D g) {
      p.paintEmptyText((JComponent)component, g);
    }
  }, null);

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:IdeBackgroundUtil.java

示例2: newImagePainter

import com.intellij.openapi.ui.AbstractPainter; //導入依賴的package包/類
public static AbstractPainter newImagePainter(final Image image, final FillType fillType, final float alpha, final Insets insets) {
  return new ImagePainter() {
    @Override
    public void executePaint(Component component, Graphics2D g) {
      executePaint(g, component, image, fillType, alpha, insets);
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:PaintersHelper.java

示例3: newImagePainter

import com.intellij.openapi.ui.AbstractPainter; //導入依賴的package包/類
public static AbstractPainter newImagePainter(@Nonnull final Image image, final Fill fillType, final Place place, final float alpha, final Insets insets) {
  return new ImagePainter() {
    @Override
    public boolean needsRepaint() {
      return true;
    }

    @Override
    public void executePaint(Component component, Graphics2D g) {
      executePaint(g, component, image, fillType, place, alpha, insets);
    }
  };
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:14,代碼來源:PaintersHelper.java

示例4: initFramePainters

import com.intellij.openapi.ui.AbstractPainter; //導入依賴的package包/類
public static void initFramePainters(@Nonnull IdeGlassPaneImpl glassPane) {
  PaintersHelper painters = glassPane.getNamedPainters(FRAME_PROP);
  PaintersHelper.initWallpaperPainter(FRAME_PROP, painters);

  ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  String path = /*UIUtil.isUnderDarcula()? appInfo.getEditorBackgroundImageUrl() : */null;
  URL url = path == null ? null : appInfo.getClass().getResource(path);
  Image centerImage = url == null ? null : ImageLoader.loadFromUrl(url);

  if (centerImage != null) {
    painters.addPainter(PaintersHelper.newImagePainter(centerImage, PaintersHelper.Fill.PLAIN, PaintersHelper.Place.TOP_CENTER, 1.0f, JBUI.insets(10, 0, 0, 0)), null);
  }
  painters.addPainter(new AbstractPainter() {
    EditorEmptyTextPainter p = EditorEmptyTextPainter.ourInstance;

    @Override
    public boolean needsRepaint() {
      return true;
    }

    @Override
    public void executePaint(Component component, Graphics2D g) {
      p.paintEmptyText((JComponent)component, g);
    }
  }, null);

}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:28,代碼來源:IdeBackgroundUtil.java

示例5: newWallpaperPainter

import com.intellij.openapi.ui.AbstractPainter; //導入依賴的package包/類
private static AbstractPainter newWallpaperPainter(@NotNull final String propertyName) {
  return new ImagePainter() {
    Image image;
    float alpha;
    Insets insets;
    FillType fillType;

    String current;

    @Override
    public void executePaint(Component component, Graphics2D g) {
      String value = StringUtil.notNullize(System.getProperty(propertyName), propertyName + ".png");
      if (!Comparing.equal(value, current)) {
        current = value;
        image = scaled = null;
        insets = JBUI.emptyInsets();
        String[] parts = value.split(",");
        try {
          alpha = StringUtil.parseInt(parts.length > 1 ? parts[1]: "", 10) / 100f;
          try {
            fillType =  FillType.valueOf(parts.length > 2 ? parts[2].toUpperCase(Locale.ENGLISH) : "");
          }
          catch (IllegalArgumentException e) {
            fillType = FillType.SCALE;
          }
          String filePath = parts[0];

          URL url = filePath.contains("://") ? new URL(filePath) :
                    (FileUtil.isAbsolutePlatformIndependent(filePath)
                     ? new File(filePath)
                     : new File(PathManager.getConfigPath(), filePath)).toURI().toURL();
          image = ImageLoader.loadFromUrl(url);
        }
        catch (Exception ignored) {
        }
      }
      if (image == null) return;
      executePaint(g, component, image, fillType, alpha, insets);
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:PaintersHelper.java


注:本文中的com.intellij.openapi.ui.AbstractPainter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。