Search in sources :

Example 6 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI in project intellij-community by JetBrains.

the class ChooseModulesDialog method createNorthPanel.

protected JComponent createNorthPanel() {
    BorderLayoutPanel panel = JBUI.Panels.simplePanel(15, 10);
    if (myIcon != null) {
        JLabel iconLabel = new JLabel(myIcon);
        panel.addToLeft(JBUI.Panels.simplePanel().addToTop(iconLabel));
    }
    BorderLayoutPanel messagePanel = JBUI.Panels.simplePanel();
    if (myMessage != null) {
        JLabel textLabel = new JLabel(myMessage);
        textLabel.setBorder(JBUI.Borders.emptyBottom(5));
        textLabel.setUI(new MultiLineLabelUI());
        messagePanel.addToTop(textLabel);
    }
    panel.add(messagePanel, BorderLayout.CENTER);
    final JScrollPane jScrollPane = ScrollPaneFactory.createScrollPane();
    jScrollPane.setViewportView(myView);
    jScrollPane.setPreferredSize(JBUI.size(300, 80));
    panel.addToBottom(jScrollPane);
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel)

Example 7 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI in project intellij-community by JetBrains.

the class MethodHierarchyBrowserBase method createStandardLegendPanel.

protected static JPanel createStandardLegendPanel(final String methodDefinedText, final String methodNotDefinedLegallyText, final String methodShouldBeDefined) {
    final JPanel panel = new JPanel(new GridBagLayout());
    final GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0);
    JLabel label = new JLabel(methodDefinedText, AllIcons.Hierarchy.MethodDefined, SwingConstants.LEFT);
    label.setUI(new MultiLineLabelUI());
    label.setIconTextGap(10);
    panel.add(label, gc);
    gc.gridy++;
    label = new JLabel(methodNotDefinedLegallyText, AllIcons.Hierarchy.MethodNotDefined, SwingConstants.LEFT);
    label.setUI(new MultiLineLabelUI());
    label.setIconTextGap(10);
    panel.add(label, gc);
    gc.gridy++;
    label = new JLabel(methodShouldBeDefined, AllIcons.Hierarchy.ShouldDefineMethod, SwingConstants.LEFT);
    label.setUI(new MultiLineLabelUI());
    label.setIconTextGap(10);
    panel.add(label, gc);
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI)

Example 8 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI in project intellij-community by JetBrains.

the class YesNoPreviewUsagesDialog method createNorthPanel.

protected JComponent createNorthPanel() {
    JLabel label = new JLabel(myMessage);
    label.setUI(new MultiLineLabelUI());
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(label, BorderLayout.CENTER);
    Icon icon = Messages.getQuestionIcon();
    if (icon != null) {
        label.setIcon(icon);
        label.setIconTextGap(7);
    }
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI)

Example 9 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI in project intellij-community by JetBrains.

the class SourcePathsStep method createComponentForEmptyRootCase.

private JComponent createComponentForEmptyRootCase() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final String text = IdeBundle.message("prompt.please.specify.java.sources.directory");
    final JLabel label = new JLabel(text);
    label.setUI(new MultiLineLabelUI());
    panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
    myRbCreateSource = new JRadioButton(IdeBundle.message("radio.create.source.directory"), true);
    panel.add(myRbCreateSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
    myTfSourceDirectoryName = new JTextField(suggestSourceDirectoryName());
    final JLabel srcPathLabel = new JLabel(IdeBundle.message("prompt.enter.relative.path.to.module.content.root", File.separator));
    panel.add(srcPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 30, 0, 0), 0, 0));
    final FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    chooserDescriptor.withTreeRootVisible(true);
    final FieldPanel fieldPanel = createFieldPanel(myTfSourceDirectoryName, null, new BrowsePathListener(myTfSourceDirectoryName, chooserDescriptor));
    panel.add(fieldPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 30, 0, 10), 0, 0));
    myRbNoSource = new JRadioButton(IdeBundle.message("radio.do.not.create.source.directory"), true);
    panel.add(myRbNoSource, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
    final JLabel fullPathLabel = new JLabel(IdeBundle.message("label.source.directory"));
    panel.add(fullPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, JBUI.insets(8, 10, 0, 10), 0, 0));
    myTfFullPath = new JTextField();
    myTfFullPath.setEditable(false);
    myTfFullPath.setOpaque(false);
    final Insets borderInsets = myTfFullPath.getBorder().getBorderInsets(myTfFullPath);
    myTfFullPath.setBorder(BorderFactory.createEmptyBorder(borderInsets.top, borderInsets.left, borderInsets.bottom, borderInsets.right));
    panel.add(myTfFullPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(8, 10), 0, 0));
    ButtonGroup group = new ButtonGroup();
    group.add(myRbCreateSource);
    group.add(myRbNoSource);
    myTfSourceDirectoryName.getDocument().addDocumentListener(new DocumentAdapter() {

        public void textChanged(DocumentEvent event) {
            updateFullPathField();
        }
    });
    myRbCreateSource.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            final boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
            srcPathLabel.setEnabled(enabled);
            fieldPanel.setEnabled(enabled);
            fullPathLabel.setVisible(enabled);
            myTfFullPath.setVisible(enabled);
            if (enabled) {
                IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
                    IdeFocusManager.getGlobalInstance().requestFocus(myTfSourceDirectoryName, true);
                });
            }
        }
    });
    return panel;
}
Also used : ItemEvent(java.awt.event.ItemEvent) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) ItemListener(java.awt.event.ItemListener) FieldPanel(com.intellij.ui.FieldPanel)

Example 10 with MultiLineLabelUI

use of com.intellij.openapi.ui.MultiLineLabelUI in project intellij-community by JetBrains.

the class ProjectJdkStep method getComponent.

public JComponent getComponent() {
    final JLabel label = new JLabel(IdeBundle.message("prompt.please.select.project.jdk"));
    label.setUI(new MultiLineLabelUI());
    final JPanel panel = new JPanel(new GridBagLayout()) {

        public Dimension getPreferredSize() {
            return new Dimension(-1, 200);
        }
    };
    panel.add(label, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
    myJDKsComponent.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
    panel.add(myJDKsComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
    return panel;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI)

Aggregations

MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)20 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 Nullable (org.jetbrains.annotations.Nullable)3 NotNull (org.jetbrains.annotations.NotNull)2 PathMacroListEditor (com.intellij.application.options.pathMacros.PathMacroListEditor)1 JavaModuleSourceRoot (com.intellij.ide.util.projectWizard.importSources.JavaModuleSourceRoot)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 MultiLineLabel (com.intellij.openapi.ui.ex.MultiLineLabel)1 CollectionComboBoxModel (com.intellij.ui.CollectionComboBoxModel)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 FieldPanel (com.intellij.ui.FieldPanel)1 JBLabel (com.intellij.ui.components.JBLabel)1 JBLoadingPanel (com.intellij.ui.components.JBLoadingPanel)1 Chunk (com.intellij.util.Chunk)1 Table (com.intellij.util.ui.Table)1 BorderLayoutPanel (com.intellij.util.ui.components.BorderLayoutPanel)1 GridBagConstraints (java.awt.GridBagConstraints)1