Search in sources :

Example 51 with JBLabel

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

the class ImportSourceRootsDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    panel.setPreferredSize(JBUI.size(350, 200));
    final JBLabel label = new JBLabel(AndroidBundle.message("android.import.dependencies.source.roots.dialog.label"));
    label.setBorder(JBUI.Borders.empty(0, 0, 5, 0));
    panel.add(label, BorderLayout.NORTH);
    panel.add(mySourcePathsChooser, BorderLayout.CENTER);
    return panel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel)

Example 52 with JBLabel

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

the class NlPropertyInspectorFixture method findPropertyComponent.

@Nullable
private Component findPropertyComponent(@NotNull String name, @Nullable Icon icon) {
    try {
        JBLabel label = waitUntilFound(robot(), myPanel, new GenericTypeMatcher<JBLabel>(JBLabel.class) {

            @Override
            protected boolean isMatching(@NotNull JBLabel label) {
                return name.equals(label.getText()) && label.getIcon() == icon;
            }
        });
        Container parent = label.getParent();
        Component[] components = parent.getComponents();
        for (int i = 0; i < components.length; i++) {
            if (label == components[i]) {
                return components[i + 1];
            }
        }
        return null;
    } catch (WaitTimedOutError ex) {
        return null;
    }
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) WaitTimedOutError(org.fest.swing.exception.WaitTimedOutError) Nullable(com.android.annotations.Nullable)

Example 53 with JBLabel

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

the class AbstractWizardStepFixture method getValidationText.

public String getValidationText() {
    JBLabel validationLabel = robot().finder().findByName(target(), "ValidationLabel", JBLabel.class);
    Wait.seconds(1).expecting("validation text to appear").until(() -> validationLabel.getText().matches(".*\\S.*"));
    return validationLabel.getText();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel)

Example 54 with JBLabel

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

the class ConfigureActivityStep method onEntering.

@Override
protected void onEntering() {
    // Verified by shouldSkip
    assert getModel().getTargetTemplate() != null;
    myRootPanel.removeAll();
    int row = 0;
    for (String param : getModel().getTargetTemplate().getParameters()) {
        myRootPanel.add(new JBLabel(param + ": "), new TabularLayout.Constraint(row, 0));
        JBTextField valueTextField = new JBTextField("Value" + (row + 1));
        valueTextField.putClientProperty("param", param);
        myRootPanel.add(valueTextField, new TabularLayout.Constraint(row, 1));
        if (row == 0) {
            myPreferredFocus = valueTextField;
        }
        row++;
    }
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) TabularLayout(com.android.tools.adtui.TabularLayout) JBTextField(com.intellij.ui.components.JBTextField)

Example 55 with JBLabel

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

the class ZoomLabelAction method createCustomComponent.

@Override
public JComponent createCustomComponent(Presentation presentation) {
    JBLabel label = new JBLabel() {

        private PropertyChangeListener myPresentationSyncer;

        private Presentation myPresentation = presentation;

        @Override
        public void addNotify() {
            super.addNotify();
            if (myPresentationSyncer == null) {
                myPresentationSyncer = new PresentationSyncer();
                myPresentation.addPropertyChangeListener(myPresentationSyncer);
            }
            setText(myPresentation.getText());
        }

        @Override
        public void removeNotify() {
            if (myPresentationSyncer != null) {
                myPresentation.removePropertyChangeListener(myPresentationSyncer);
                myPresentationSyncer = null;
            }
            super.removeNotify();
        }

        class PresentationSyncer implements PropertyChangeListener {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if (Presentation.PROP_TEXT.equals(propertyName)) {
                    setText((String) evt.getNewValue());
                    invalidate();
                    repaint();
                }
            }
        }
    };
    label.setFont(UIUtil.getToolTipFont());
    return label;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) JBLabel(com.intellij.ui.components.JBLabel) Presentation(com.intellij.openapi.actionSystem.Presentation)

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