Java 类com.intellij.util.ui.JBSwingUtilities 实例源码

项目:Riho    文件:CharacterRenderer.java   
public void render(Component c, Graphics g, int x, int y, int width, int height) {
    if (!(c.getParent() instanceof JViewport)) {
        return;
    }
    JViewport viewport = (JViewport) c.getParent();
    width = viewport.getWidth();
    height = viewport.getHeight();
    x = viewport.getViewRect().x;
    y = viewport.getViewRect().y;

    if (isHide(width, height)) {
        return;
    }
    Instant now = Instant.now();

    int imageWidth = characterBase.getWidth();
    int imageHeight = characterBase.getHeight();
    int margin = ImageUtil.defaultScale(30);
    int charaX = width - imageWidth - margin + x;
    int charaY = height - imageHeight + y;
    Graphics2D g2d = JBSwingUtilities.runGlobalCGTransform((JComponent) c, g);
    CharacterPosition position = CharacterPosition.of(charaX, charaY);

    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f));
    ImageUtil.drawImage(g2d, characterBase, charaX, charaY);
    faceRenderer.render(now, g2d, position, riho);
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1));
    emotionRenderer.render(now, g2d, position, riho);
}
项目:guards    文件:GuardPopupController.java   
static JList findJList(ListPopup popup) {
    Set<Component> lists = JBSwingUtilities.uiTraverser().preOrderTraversal(popup.getContent())
            .filter(new FilteringIterator.InstanceOf<>(JList.class)).toSet();
    if ( lists.size() != 1 ) {
        throw new IllegalStateException("Expected exactly one JList");
    }
    return (JList)lists.iterator().next();
}
项目:guards    文件:ExtendedKeyboardActionDispatcher.java   
ExtendedKeyboardActionDispatcher(ListPopup popup) {
    this.popup = popup;
    Set<Component> lists = JBSwingUtilities.uiTraverser().preOrderTraversal(popup.getContent())
            .filter(new FilteringIterator.InstanceOf<>(JList.class)).toSet();
    if ( lists.size() != 1 ) {
        list = null;
    }
    else {
        list = (JList)lists.iterator().next();
    }
}
项目:consulo    文件:IdeBackgroundUtil.java   
public static void createTemporaryBackgroundTransform(JPanel root, String tmp, Disposable disposable) {
  PaintersHelper paintersHelper = new PaintersHelper(root);
  PaintersHelper.initWallpaperPainter(tmp, paintersHelper);
  Disposer.register(disposable, JBSwingUtilities.addGlobalCGTransform((t, v) -> {
    if (!UIUtil.isAncestor(root, t)) return v;
    return MyGraphics.wrap(v, paintersHelper, t);
  }));
}
项目:intellij-ce-playground    文件:DnDAwareTree.java   
@Override
protected void processMouseMotionEvent(MouseEvent e) {
  if (SystemInfo.isMac && JBSwingUtilities.isRightMouseButton(e) && e.getID() == MouseEvent.MOUSE_DRAGGED) return;
  super.processMouseMotionEvent(e);
}
项目:material-theme-jetbrains    文件:MTFrameComponentExtension.java   
@Override
protected Graphics getComponentGraphics(final Graphics graphics) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
}
项目:consulo    文件:JBPanelWithEmptyText.java   
@Override
protected Graphics getComponentGraphics(Graphics graphics) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
}
项目:consulo    文件:TextEditorComponent.java   
@Override
protected Graphics getComponentGraphics(Graphics g) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(g));
}
项目:consulo    文件:EditorGutterComponentImpl.java   
@Override
protected Graphics getComponentGraphics(Graphics graphics) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
}
项目:consulo    文件:EditorComponentImpl.java   
@Override
protected Graphics getComponentGraphics(Graphics graphics) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
}
项目:consulo    文件:DnDAwareTree.java   
@Override
protected void processMouseMotionEvent(MouseEvent e) {
  if (SystemInfo.isMac && JBSwingUtilities.isRightMouseButton(e) && e.getID() == MouseEvent.MOUSE_DRAGGED) return;
  super.processMouseMotionEvent(e);
}
项目:consulo    文件:NavBarRootPaneExtension.java   
@Override
protected Graphics getComponentGraphics(Graphics graphics) {
  return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
}