Java Code Examples for com.intellij.ui.components.JBLabel#setToolTipText()

The following examples show how to use com.intellij.ui.components.JBLabel#setToolTipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReportDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
private void addFailed(final BaseReport report) {
    //Icon
    JBLabel iconLabel = new JBLabel(PluginIcons.REPORT_FAIL);
    iconLabel.setToolTipText(Localizer.get("tooltip.ReportFailed"));

    //Label
    JBLabel label = new JBLabel(report.getAction().toString(), report.toIcon(), SwingConstants.LEFT);

    // Button details
    JButton btnDetails = new JButton(Localizer.get("action.ShowDetails"), AllIcons.General.InspectionsEye);
    btnDetails.repaint();
    btnDetails.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            Messages.showMessageDialog(
                    report.getMessage(),
                    Localizer.get("title.ErrorDetails"),
                    Messages.getInformationIcon()
            );
        }
    });

    panel.add(iconLabel, new CC().spanX().split(3));
    panel.add(label, new CC());
    panel.add(btnDetails, new CC().wrap().pad(0, 0, 0, 0));
}
 
Example 2
Source File: TextNodeRenderer.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public Component render(Object value) {
  BuckTextNode node = (BuckTextNode) value;

  if (node.getText().isEmpty()) {
    return new JLabel("");
  }

  Icon icon = AllIcons.General.Information;
  if (node.getTextType() == BuckTextNode.TextType.ERROR) {
    icon = AllIcons.Ide.FatalError;
  } else if (node.getTextType() == BuckTextNode.TextType.WARNING) {
    icon = AllIcons.General.Warning;
  }

  String message =
      "<html><pre style='margin:0px'>"
          + HtmlEscapers.htmlEscaper().escape(node.getText())
          + "</pre></html>";

  JBLabel result = new JBLabel(message, icon, SwingConstants.LEFT);

  result.setToolTipText("<pre>" + node.getText() + "</pre>");

  return result;
}
 
Example 3
Source File: ReportDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void addSuccess(BaseReport report) {
    // Icon
    JBLabel iconLabel = new JBLabel(PluginIcons.REPORT_SUCCESS);
    iconLabel.setToolTipText(Localizer.get("tooltip.ReportSuccess"));

    // Label
    JBLabel label = new JBLabel(report.getAction().toString(), report.toIcon(), SwingConstants.LEFT);

    panel.add(iconLabel, new CC().spanX().split(2));
    panel.add(label, new CC().wrap());
}
 
Example 4
Source File: ReportDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
private void addPending(BaseReport report) {
    //Icon
    JBLabel iconLabel = new JBLabel(PluginIcons.REPORT_NEUTRAL);
    iconLabel.setToolTipText(Localizer.get("tooltip.ReportPending"));

    //Label
    JBLabel label = new JBLabel(report.getAction().toString(), report.toIcon(), SwingConstants.LEFT);

    panel.add(iconLabel, new CC().spanX().split(2));
    panel.add(label, new CC().wrap());
}
 
Example 5
Source File: FrameRenderingDisplay.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void updateTargetLabelForRefreshRate(@Nullable Double fps, @NotNull Double defaultRefreshRate, JBLabel targetLabel) {
  if (fps == null) {
    fps = defaultRefreshRate;
  }
  final double targetFrameTime = Math.floor(1000.0f / fps);
  final String targetFrameTimeText = Math.round(targetFrameTime) + "ms";
  targetLabel.setText(targetFrameTimeText);
  targetLabel
    .setToolTipText("Targeting " + targetFrameTimeText + " per frame will\nresult in "
                    + Math.round(fps) + " frames per second. ");
  SwingUtilities.invokeLater(targetLabel::repaint);
}
 
Example 6
Source File: FrameRenderingDisplay.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void updateTargetLabelForRefreshRate(@Nullable Double fps, @NotNull Double defaultRefreshRate, JBLabel targetLabel) {
  if (fps == null) {
    fps = defaultRefreshRate;
  }
  final double targetFrameTime = Math.floor(1000.0f / fps);
  final String targetFrameTimeText = Math.round(targetFrameTime) + "ms";
  targetLabel.setText(targetFrameTimeText);
  targetLabel
    .setToolTipText("Targeting " + targetFrameTimeText + " per frame will\nresult in "
                    + Math.round(fps) + " frames per second. ");
  SwingUtilities.invokeLater(targetLabel::repaint);
}
 
Example 7
Source File: ProjectViewUi.java    From intellij with Apache License 2.0 5 votes vote down vote up
public void fillUi(JPanel canvas) {
  String tooltip =
      "Enter a project view descriptor file."
          + (Blaze.defaultBuildSystem() == BuildSystem.Blaze
              ? " See 'go/intellij/docs/project-views.md' for more information."
              : "");

  projectViewEditor = createEditor(tooltip);
  projectViewEditor
      .getColorsScheme()
      .setColor(EditorColors.READONLY_BACKGROUND_COLOR, UIManager.getColor("Label.background"));
  Disposer.register(
      parentDisposable, () -> EditorFactory.getInstance().releaseEditor(projectViewEditor));

  JBLabel labelsLabel = new JBLabel("Project View");
  labelsLabel.setToolTipText(tooltip);
  canvas.add(labelsLabel, UiUtil.getFillLineConstraints(0));

  canvas.add(projectViewEditor.getComponent(), UiUtil.getFillLineConstraints(0));

  useShared = new JCheckBox(USE_SHARED_PROJECT_VIEW);
  useShared.addActionListener(
      e -> {
        useSharedProjectView = useShared.isSelected();
        if (useSharedProjectView) {
          setProjectViewText(sharedProjectViewText);
        }
        updateTextAreasEnabled();
      });
  canvas.add(useShared, UiUtil.getFillLineConstraints(0));
}