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


Java Balloon.Position方法代碼示例

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


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

示例1: showBalloonForComponent

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type,
                                           final boolean atTop, @Nullable final Disposable disposable) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  if (popupFactory == null) return;
  BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null);
  balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable);
  Balloon balloon = balloonBuilder.createBalloon();
  Dimension size = component.getSize();
  Balloon.Position position;
  int x;
  int y;
  if (size == null) {
    x = y = 0;
    position = Balloon.Position.above;
  }
  else {
    x = Math.min(10, size.width / 2);
    y = size.height;
    position = Balloon.Position.below;
  }
  balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:PopupUtil.java

示例2: showBalloon

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
 * Asks to show balloon that contains information related to the given component.
 *
 * @param component    component for which we want to show information
 * @param messageType  balloon message type
 * @param message      message to show
 */
public static void showBalloon(@NotNull JComponent component, @NotNull MessageType messageType, @NotNull String message) {
  final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
    .setDisposable(ApplicationManager.getApplication())
    .setFadeoutTime(BALLOON_FADEOUT_TIME);
  Balloon balloon = builder.createBalloon();
  Dimension size = component.getSize();
  Balloon.Position position;
  int x;
  int y;
  if (size == null) {
    x = y = 0;
    position = Balloon.Position.above;
  }
  else {
    x = Math.min(10, size.width / 2);
    y = size.height;
    position = Balloon.Position.below;
  }
  balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ExternalSystemUiUtil.java

示例3: fixActualPoint

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void fixActualPoint(Point actualPoint) {
  if (!isAwtTooltip()) return;
  if (!myIsRealPopup) return;

  Dimension size = myComponent.getPreferredSize();
  Balloon.Position position = myHintHint.getPreferredPosition();
  int shift = BalloonImpl.getPointerLength(position, false);
  switch (position) {
    case below:
      actualPoint.y += shift;
      break;
    case above:
      actualPoint.y -= (shift + size.height);
      break;
    case atLeft:
      actualPoint.x -= (shift + size.width);
      break;
    case atRight:
      actualPoint.y += shift;
      break;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:LightweightHint.java

示例4: fitsLayeredPane

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static boolean fitsLayeredPane(JLayeredPane pane, JComponent component, RelativePoint desiredLocation, HintHint hintHint) {
  if (hintHint.isAwtTooltip()) {
    Dimension size = component.getPreferredSize();
    Dimension paneSize = pane.getSize();

    Point target = desiredLocation.getPointOn(pane).getPoint();
    Balloon.Position pos = hintHint.getPreferredPosition();
    int pointer = BalloonImpl.getPointerLength(pos, false) + BalloonImpl.getNormalInset();
    if (pos == Balloon.Position.above || pos == Balloon.Position.below) {
      boolean heightFit = target.y - size.height - pointer > 0 || target.y + size.height + pointer < paneSize.height;
      return heightFit && size.width + pointer < paneSize.width;
    }
    else {
      boolean widthFit = target.x - size.width - pointer > 0 || target.x + size.width + pointer < paneSize.width;
      return widthFit && size.height + pointer < paneSize.height;
    }
  }
  else {
    final Rectangle lpRect = new Rectangle(pane.getLocationOnScreen().x, pane.getLocationOnScreen().y, pane.getWidth(), pane.getHeight());
    Rectangle componentRect = new Rectangle(desiredLocation.getScreenPoint().x,
                                            desiredLocation.getScreenPoint().y,
                                            component.getPreferredSize().width,
                                            component.getPreferredSize().height);
    return lpRect.contains(componentRect);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:LightweightHint.java

示例5: show

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
@Override
public void show(PositionTracker<Balloon> tracker, Balloon.Position position) {
  AbstractPosition pos = BELOW;
  switch (position) {
    case atLeft:
      pos = AT_LEFT;
      break;
    case atRight:
      pos = AT_RIGHT;
      break;
    case below:
      pos = BELOW;
      break;
    case above:
      pos = ABOVE;
      break;
  }

  show(tracker, pos);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:BalloonImpl.java

示例6: showBalloon

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
 * Asks to show balloon that contains information related to the given component.
 *
 * @param component    component for which we want to show information
 * @param messageType  balloon message type
 * @param message      message to show
 */
public static void showBalloon(@NotNull JComponent component, @NotNull MessageType messageType, @NotNull String message) {
  final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
    .setDisposable(ApplicationManager.getApplication())
    .setFadeoutTime(TimeUnit.SECONDS.toMillis(1));
  Balloon balloon = builder.createBalloon();
  Dimension size = component.getSize();
  Balloon.Position position;
  int x;
  int y;
  if (size == null) {
    x = y = 0;
    position = Balloon.Position.above;
  }
  else {
    x = Math.min(10, size.width / 2);
    y = size.height;
    position = Balloon.Position.below;
  }
  balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:28,代碼來源:ExternalSystemUiUtil.java

示例7: show

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void show(PositionTracker<Balloon> tracker, Balloon.Position position) {
  AbstractPosition pos = BELOW;
  switch (position) {
    case atLeft:
      pos = AT_LEFT;
      break;
    case atRight:
      pos = AT_RIGHT;
      break;
    case below:
      pos = BELOW;
      break;
    case above:
      pos = ABOVE;
      break;
  }

  show(tracker, pos);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:BalloonImpl.java

示例8: showBalloon

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
 * Asks to show balloon that contains information related to the given component.
 *
 * @param component    component for which we want to show information
 * @param messageType  balloon message type
 * @param message      message to show
 */
public static void showBalloon(@Nonnull JComponent component, @Nonnull MessageType messageType, @Nonnull String message) {
  final BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, null)
    .setDisposable(ApplicationManager.getApplication())
    .setFadeoutTime(BALLOON_FADEOUT_TIME);
  Balloon balloon = builder.createBalloon();
  Dimension size = component.getSize();
  Balloon.Position position;
  int x;
  int y;
  if (size == null) {
    x = y = 0;
    position = Balloon.Position.above;
  }
  else {
    x = Math.min(10, size.width / 2);
    y = size.height;
    position = Balloon.Position.below;
  }
  balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:28,代碼來源:ExternalSystemUiUtil.java

示例9: updatePosition

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void updatePosition(Balloon.Position position) {
  if (myHintHint != null) {
    myHintHint.setPreferredPosition(position);
  }
  if (myCurrentIdeTooltip != null) {
    myCurrentIdeTooltip.setPreferredPosition(position);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:LightweightHint.java

示例10: show

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void show(RelativePoint point, Balloon.Position position) {
  final GotItPanel panel = new GotItPanel();
  panel.myTitle.setText(myTitle);

  panel.myMessage.setText(myMessage);
  if (myHyperlinkListener != null) {
    panel.myMessage.addHyperlinkListener(myHyperlinkListener);
  }

  panel.myButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

  final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(panel.myRoot);
  if (myDisposable != null) {
    builder.setDisposable(myDisposable);
  }

  final Balloon balloon = builder
    .setFillColor(UIUtil.getListBackground())
    .setHideOnClickOutside(false)
    .setHideOnAction(false)
    .setHideOnFrameResize(false)
    .setHideOnKeyOutside(false)
    .setShowCallout(myShowCallout)
    .setBlockClicksThroughBalloon(true)
    .createBalloon();

  panel.myButton.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      balloon.hide();
      if (myCallback != null) {
        myCallback.run();
      }
    }
  });

  balloon.show(point, position);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:39,代碼來源:GotItMessage.java

示例11: showNotification

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public static void showNotification(final JComponent component, final MessageType info, final String message, final Balloon.Position position) {
    runInSwingThread(new Runnable() {
        @Override
        public void run() {
            JBPopupFactory.getInstance().createBalloonBuilder(new JLabel(message))
                    .setFillColor(info.getPopupBackground())
                    .createBalloon()
                    .show(new RelativePoint(component, new Point(0, 0)), position);
        }
    });
}
 
開發者ID:dboissier,項目名稱:nosql4idea,代碼行數:12,代碼來源:GuiUtils.java

示例12: fitsLayeredPane

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static boolean fitsLayeredPane(JLayeredPane pane,
                                       JComponent component,
                                       RelativePoint desiredLocation,
                                       HintHint hintHint) {
  if (hintHint.isAwtTooltip()) {
    Dimension size = component.getPreferredSize();
    Dimension paneSize = pane.getSize();

    Point target = desiredLocation.getPointOn(pane).getPoint();
    Balloon.Position pos = hintHint.getPreferredPosition();
    int pointer = BalloonImpl.getPointerLength(pos, false) + BalloonImpl.getNormalInset();
    if (pos == Balloon.Position.above || pos == Balloon.Position.below) {
      boolean heightFit = target.y - size.height - pointer > 0 || target.y + size.height + pointer < paneSize.height;
      return heightFit && size.width + pointer < paneSize.width;
    }
    else {
      boolean widthFit = target.x - size.width - pointer > 0 || target.x + size.width + pointer < paneSize.width;
      return widthFit && size.height + pointer < paneSize.height;
    }
  }
  else {
    final Rectangle lpRect =
            new Rectangle(pane.getLocationOnScreen().x, pane.getLocationOnScreen().y, pane.getWidth(),
                          pane.getHeight());
    Rectangle componentRect = new Rectangle(desiredLocation.getScreenPoint().x, desiredLocation.getScreenPoint().y,
                                            component.getPreferredSize().width, component.getPreferredSize().height);
    return lpRect.contains(componentRect);
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:30,代碼來源:LightweightHint.java

示例13: show

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public void show(RelativePoint point, Balloon.Position position) {
  final GotItPanel panel = new GotItPanel();
  panel.myTitle.setText(myTitle);
  panel.myMessage.setText(myMessage);

  panel.myButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  final BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(panel.myRoot);
  if (myDisposable != null) {
    builder.setDisposable(myDisposable);
  }

  builder.setFillColor(UIUtil.getListBackground());
  builder.setHideOnClickOutside(false);
  builder.setHideOnAction(false);
  builder.setHideOnFrameResize(false);
  builder.setHideOnKeyOutside(false);
  builder.setShowCallout(myShowCallout);
  builder.setBlockClicksThroughBalloon(true);
  final Balloon balloon = builder.createBalloon();
  panel.myButton.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      balloon.hide();
      if (myCallback != null) {
        myCallback.run();
      }
    }
  });

  balloon.show(point, position);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:32,代碼來源:GotItMessage.java

示例14: actionPerformed

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
/**
 * @param event    ActionSystem event
 */
public void actionPerformed(AnActionEvent event) {
    String[] sweepPaths = {};

    String sweepPathsPrefString = SweepPreferences.getPaths();
    if (sweepPathsPrefString != null && ! sweepPathsPrefString.isEmpty()) {
        sweepPaths  = StringHelper.extractTreePathStringsFromPref(sweepPathsPrefString);
    }

    if (sweepPaths == null || sweepPaths.length == 0) {
        JOptionPane.showMessageDialog(null, "Please configure path(s) to be swept in the plugin preferences.");
    } else {
        Integer[] amountDeleted = this.sweepFoldersContent(sweepPaths);

        Balloon.Position pos = Balloon.Position.below;
        String balloonText   = "Deleted " + amountDeleted[1] + " files / " + amountDeleted[0] + " directories";

        JBColor backgroundColor = new JBColor(new Color(245, 245, 245), new Color(60, 63, 65));
        BalloonBuilder builder = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(balloonText, null, backgroundColor, null);
        Balloon balloon = builder.createBalloon();
        balloon.setAnimationEnabled(true);

        Component eventComponent = event.getInputEvent().getComponent();
        Point componentLocation = eventComponent.getLocation();
        Integer    x= new Double(componentLocation.getX()).intValue() + eventComponent.getWidth() + 40;
        Integer    y= new Double(componentLocation.getY()).intValue() + eventComponent.getHeight() + 42;
        RelativePoint balloonPosition = new RelativePoint(new Point(x, y));

        balloon.show(balloonPosition, pos);

        VirtualFileManager.getInstance().asyncRefresh(null);
    }
}
 
開發者ID:kstenschke,項目名稱:sweep-plugin,代碼行數:36,代碼來源:SweepAction.java

示例15: setPreferredPosition

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
public HintHint setPreferredPosition(Balloon.Position position) {
  myPreferredPosition = position;
  return this;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:HintHint.java


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