@NotNull
  @Override
  public BalloonBuilder createHtmlTextBalloonBuilder(
      @NotNull final String htmlContent,
      @Nullable final Icon icon,
      final Color fillColor,
      @Nullable final HyperlinkListener listener) {

    JEditorPane text =
        IdeTooltipManager.initPane(htmlContent, new HintHint().setAwtTooltip(true), null);

    if (listener != null) {
      text.addHyperlinkListener(listener);
    }
    text.setEditable(false);
    NonOpaquePanel.setTransparent(text);
    text.setBorder(null);

    JLabel label = new JLabel();
    final JPanel content =
        new NonOpaquePanel(
            new BorderLayout(
                (int) (label.getIconTextGap() * 1.5), (int) (label.getIconTextGap() * 1.5)));

    final NonOpaquePanel textWrapper = new NonOpaquePanel(new GridBagLayout());
    JScrollPane scrolledText = new JScrollPane(text);
    scrolledText.setBackground(fillColor);
    scrolledText.getViewport().setBackground(fillColor);
    scrolledText.getViewport().setBorder(null);
    scrolledText.setBorder(null);
    textWrapper.add(scrolledText);
    content.add(textWrapper, BorderLayout.CENTER);

    final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout());
    north.add(new JLabel(icon), BorderLayout.NORTH);
    content.add(north, BorderLayout.WEST);

    content.setBorder(new EmptyBorder(2, 4, 2, 4));

    final BalloonBuilder builder = createBalloonBuilder(content);

    builder.setFillColor(fillColor);

    return builder;
  }
Beispiel #2
0
  public WizardPopup(@Nullable JBPopup aParent, @NotNull PopupStep<Object> aStep) {
    myParent = (WizardPopup) aParent;
    myStep = aStep;

    mySpeedSearch.setEnabled(myStep.isSpeedSearchEnabled());

    final JComponent content = createContent();

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(content);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getHorizontalScrollBar().setBorder(null);

    scrollPane.getActionMap().get("unitScrollLeft").setEnabled(false);
    scrollPane.getActionMap().get("unitScrollRight").setEnabled(false);

    scrollPane.setBorder(null);

    final Project project =
        CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
    init(
        project,
        scrollPane,
        getPreferredFocusableComponent(),
        true,
        true,
        true,
        null,
        false,
        aStep.getTitle(),
        null,
        true,
        null,
        false,
        null,
        null,
        null,
        false,
        null,
        true,
        false,
        true,
        null,
        0f,
        null,
        true,
        false,
        new Component[0],
        null,
        SwingConstants.LEFT,
        true,
        Collections.<Pair<ActionListener, KeyStroke>>emptyList(),
        null,
        null,
        false,
        true,
        true,
        true,
        null);

    registerAction(
        "disposeAll",
        KeyEvent.VK_ESCAPE,
        InputEvent.SHIFT_MASK,
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (mySpeedSearch.isHoldingFilter()) {
              mySpeedSearch.reset();
            } else {
              disposeAll();
            }
          }
        });

    AbstractAction goBackAction =
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            goBack();
          }
        };

    registerAction("goBack3", KeyEvent.VK_ESCAPE, 0, goBackAction);

    myMnemonicsSearch =
        new MnemonicsSearch(this) {
          @Override
          protected void select(Object value) {
            onSelectByMnemonic(value);
          }
        };
  }