Search in sources :

Example 56 with JBLabel

use of com.intellij.ui.components.JBLabel in project android by JetBrains.

the class InspectorPanel method createLabel.

private static JLabel createLabel(@NotNull String labelText, @Nullable String tooltip, @Nullable Component component) {
    JBLabel label = new JBLabel(labelText);
    label.setLabelFor(component);
    label.setToolTipText(tooltip);
    return label;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel)

Example 57 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class UndoApplyPatchDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    int numFiles = myFailedFilePaths.size();
    JPanel labelsPanel = new JPanel(new BorderLayout());
    String detailedText = numFiles == 0 ? "" : String.format("Failed to apply %s below.<br>", StringUtil.pluralize("file", numFiles));
    final JLabel infoLabel = new JBLabel(XmlStringUtil.wrapInHtml(detailedText + "Would you like to rollback all applied?"));
    labelsPanel.add(infoLabel, BorderLayout.NORTH);
    if (myShouldInformAboutBinaries) {
        JLabel warningLabel = new JLabel("Rollback will not affect binaries");
        warningLabel.setIcon(UIUtil.getBalloonWarningIcon());
        labelsPanel.add(warningLabel, BorderLayout.CENTER);
    }
    panel.add(labelsPanel, BorderLayout.NORTH);
    if (numFiles > 0) {
        FilePathChangesTreeList browser = new FilePathChangesTreeList(myProject, myFailedFilePaths, false, false, null, null) {

            @Override
            public Dimension getPreferredSize() {
                return new Dimension(infoLabel.getPreferredSize().width, 50);
            }
        };
        browser.setChangesToDisplay(myFailedFilePaths);
        panel.add(ScrollPaneFactory.createScrollPane(browser), BorderLayout.CENTER);
    }
    return panel;
}
Also used : FilePathChangesTreeList(com.intellij.openapi.vcs.changes.ui.FilePathChangesTreeList) JBLabel(com.intellij.ui.components.JBLabel) Nullable(org.jetbrains.annotations.Nullable)

Example 58 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class PluginConflictDialog method getPluginDescriptionPanel.

@NotNull
private static JPanel getPluginDescriptionPanel(@NotNull PluginId plugin, boolean addUseWord) {
    final JPanel panel = new JPanel(new BorderLayout());
    final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(plugin);
    if (pluginDescriptor == null) {
        panel.add(new JBLabel(plugin.getIdString()), BorderLayout.CENTER);
        return panel;
    }
    final StringBuilder sb = new StringBuilder("<html>");
    if (addUseWord) {
        sb.append("Use ");
    }
    sb.append(pluginDescriptor.getName());
    if (pluginDescriptor.getVendor() != null) {
        sb.append(" by ").append(pluginDescriptor.getVendor());
    }
    sb.append("</html>");
    panel.add(new JBLabel(sb.toString()));
    return panel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) NotNull(org.jetbrains.annotations.NotNull)

Example 59 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class PluginConflictDialog method getDisableAllPanel.

@NotNull
private static JPanel getDisableAllPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JBLabel(DiagnosticBundle.message("error.dialog.conflict.plugin.disable.all")));
    return panel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) NotNull(org.jetbrains.annotations.NotNull)

Example 60 with JBLabel

use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.

the class InplaceChangeSignature method showBalloon.

protected void showBalloon() {
    NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method"));
    checkBox.addActionListener(e -> {
        myDelegate = checkBox.isSelected();
        updateCurrentInfo();
    });
    JPanel content = new JPanel(new BorderLayout());
    content.add(new JBLabel("Performed signature modifications:"), BorderLayout.NORTH);
    content.add(myPreview.getComponent(), BorderLayout.CENTER);
    updateMethodSignature(myStableChange);
    content.add(checkBox, BorderLayout.SOUTH);
    final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true);
    myBalloon = balloonBuilder.createBalloon();
    myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
    myBalloon.show(new PositionTracker<Balloon>(myEditor.getContentComponent()) {

        @Override
        public RelativePoint recalculateLocation(Balloon object) {
            int offset = myStableChange.getMethod().getTextOffset();
            VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
            Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column));
            return new RelativePoint(myEditor.getContentComponent(), point);
        }
    }, Balloon.Position.above);
    Disposer.register(myBalloon, () -> {
        EditorFactory.getInstance().releaseEditor(myPreview);
        myPreview = null;
    });
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) NonFocusableCheckBox(com.intellij.ui.NonFocusableCheckBox) Balloon(com.intellij.openapi.ui.popup.Balloon) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) BalloonBuilder(com.intellij.openapi.ui.popup.BalloonBuilder)

Aggregations

JBLabel (com.intellij.ui.components.JBLabel)98 Nullable (org.jetbrains.annotations.Nullable)23 NotNull (org.jetbrains.annotations.NotNull)11 JBCheckBox (com.intellij.ui.components.JBCheckBox)10 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 ComboBox (com.intellij.openapi.ui.ComboBox)7 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)7 GridBag (com.intellij.util.ui.GridBag)7 List (java.util.List)7 JBList (com.intellij.ui.components.JBList)6 JBTable (com.intellij.ui.table.JBTable)6 JBTextField (com.intellij.ui.components.JBTextField)5 DocumentEvent (javax.swing.event.DocumentEvent)5 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 Project (com.intellij.openapi.project.Project)4 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)4 StringUtil (com.intellij.openapi.util.text.StringUtil)4 java.awt (java.awt)4 ArrayList (java.util.ArrayList)4