Search in sources :

Example 11 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project Perl5-IDEA by Camelcade.

the class TemplateToolkitSettingsConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    FormBuilder builder = FormBuilder.createFormBuilder();
    builder.getPanel().setLayout(new VerticalFlowLayout());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.opentag"), startTagField = new JTextField());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.closetag"), endTagField = new JTextField());
    builder.addLabeledComponent(PerlBundle.message("ttk2.label.outlinetag"), outlineTagField = new JTextField());
    builder.addComponent(enableAnycaseCheckBox = new JCheckBox(PerlBundle.message("ttk2.label.enableanycase")));
    // noinspection Since15
    substitutedExtensionsModel = new CollectionListModel<>();
    substitutedExtensionsList = new JBList<>(substitutedExtensionsModel);
    substitutedExtensionsPanel = PerlConfigurationUtil.createSubstituteExtensionPanel(substitutedExtensionsModel, substitutedExtensionsList);
    builder.addLabeledComponent(new JLabel(PerlBundle.message("ttk2.configuration.extension")), substitutedExtensionsPanel);
    return builder.getPanel();
}
Also used : FormBuilder(com.intellij.util.ui.FormBuilder) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 12 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project Perl5-IDEA by Camelcade.

the class PerlContentEntriesTreeEditor method createComponent.

@NotNull
@Override
public JComponent createComponent() {
    JPanel panel = new JPanel(new VerticalFlowLayout());
    panel.add(myTreePanel);
    return panel;
}
Also used : VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project sonarlint-intellij by SonarSource.

the class SonarLintAboutPanel method createTelemetryPanel.

private JComponent createTelemetryPanel() {
    // tooltip
    final HyperlinkLabel link = new HyperlinkLabel("");
    link.setHyperlinkText("See a ", "sample of the data", "");
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            final JLabel label = new JLabel("<html><pre>{\n" + "    \"days_since_installation\": 120,\n" + "    \"days_of_use\": 40,\n" + "    \"sonarlint_version\": \"2.9\",\n" + "    \"sonarlint_product\": \"SonarLint IntelliJ\",\n" + "    \"connected_mode_used\": true\n" + "    \"system_time\":\"2018-06-27T16:31:49.173+01:00\",\n" + "    \"install_time\":\"2018-02-27T16:30:49.124+01:00\"\n" + "    \"analyses\":[{\"language\":\"java\",\"rate_per_duration\":{\"0-300\":100,\"300-500\":0,\"500-1000\":0,\"1000-2000\":0,\"2000-4000\":0,\"4000+\":0}}]\n" + "}</pre><html>");
            label.setBorder(HintUtil.createHintBorder());
            label.setBackground(HintUtil.INFORMATION_COLOR);
            label.setOpaque(true);
            HintManager.getInstance().showHint(label, RelativePoint.getNorthWestOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
        }
    });
    // info
    JBLabel info = new JBLabel("<html>By sharing anonymous SonarLint usage statistics, you help us understand how SonarLint is used so " + "we can improve the plugin to work even better for you. We don't collect source code, IP addresses, or any personally identifying " + "information. And we don't share the data with anyone else.</html>");
    // checkbox
    enableCheckBox = new JCheckBox("Share anonymous SonarLint statistics");
    enableCheckBox.setFocusable(false);
    JPanel tickOptions = new JPanel(new VerticalFlowLayout());
    tickOptions.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    tickOptions.add(enableCheckBox);
    // all telemetry together
    JPanel infoPanel = new JPanel(new GridBagLayout());
    infoPanel.setBorder(IdeBorderFactory.createTitledBorder("Statistics"));
    GridBagConstraints c = new GridBagConstraints();
    c.gridheight = 1;
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.NORTH;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0f;
    infoPanel.add(info, c);
    c.gridy = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    infoPanel.add(link, c);
    c.gridy = 2;
    c.weighty = 1.0f;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.BOTH;
    infoPanel.add(tickOptions, c);
    return infoPanel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) HyperlinkEvent(javax.swing.event.HyperlinkEvent) GridBagLayout(java.awt.GridBagLayout) JBLabel(com.intellij.ui.components.JBLabel) JLabel(javax.swing.JLabel) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 14 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project sonarlint-intellij by SonarSource.

the class SonarLintGlobalOptionsPanel method createTopPanel.

private JPanel createTopPanel() {
    autoTrigger = new JCheckBox("Automatically trigger analysis");
    autoTrigger.setFocusable(false);
    JPanel tickOptions = new JPanel(new VerticalFlowLayout());
    tickOptions.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    tickOptions.add(autoTrigger);
    return tickOptions;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 15 with VerticalFlowLayout

use of com.intellij.openapi.ui.VerticalFlowLayout in project android by JetBrains.

the class DeviceConfiguratorPanel method createUIComponents.

private void createUIComponents() {
    myQualifierOptionsPanel = new JPanel(new CardLayout());
    final JPanel leftPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5)));
    myAvailableQualifiersList = new JBList();
    myAvailableQualifiersList.setMinimumSize(JBUI.size(10, 10));
    JBLabel label = new JBLabel(AndroidBundle.message("android.layout.preview.edit.configuration.available.qualifiers.label"));
    label.setLabelFor(myAvailableQualifiersList);
    leftPanel.add(label, BorderLayout.NORTH);
    leftPanel.add(new JBScrollPane(myAvailableQualifiersList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
    final JPanel rightPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5)));
    myChosenQualifiersList = new JBList();
    myChosenQualifiersList.setMinimumSize(JBUI.size(10, 10));
    label = new JBLabel(AndroidBundle.message("android.layout.preview.edit.configuration.choosen.qualifiers.label"));
    label.setLabelFor(myChosenQualifiersList);
    rightPanel.add(label, BorderLayout.NORTH);
    rightPanel.add(new JBScrollPane(myChosenQualifiersList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
    final JPanel buttonsPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.MIDDLE, 0, 0, true, false));
    myAddQualifierButton = new JButton(">>");
    buttonsPanel.add(myAddQualifierButton);
    myRemoveQualifierButton = new JButton("<<");
    buttonsPanel.add(myRemoveQualifierButton);
    final int gap = 5;
    final JPanel listsPanel = new JPanel(new AbstractLayoutManager() {

        @SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
        @Override
        public Dimension preferredLayoutSize(Container target) {
            synchronized (target.getTreeLock()) {
                final Dimension leftPref = leftPanel.getPreferredSize();
                final Dimension rightPref = rightPanel.getPreferredSize();
                final Dimension middlePref = buttonsPanel.getPreferredSize();
                final Insets insets = target.getInsets();
                final int width = leftPref.width + middlePref.width + rightPref.width + insets.left + insets.right + gap * 2;
                final int height = Math.max(leftPref.height, Math.max(rightPref.height, middlePref.height)) + insets.top + insets.bottom;
                return new Dimension(width, height);
            }
        }

        @SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
        @Override
        public void layoutContainer(Container target) {
            synchronized (target.getTreeLock()) {
                final Insets insets = target.getInsets();
                int top = insets.top;
                int bottom = target.getHeight() - insets.bottom;
                int left = insets.left;
                int right = target.getWidth() - insets.right;
                final int middleWidth = buttonsPanel.getPreferredSize().width + gap * 2;
                final int listWidth = (right - left - middleWidth) / 2;
                final int height = bottom - top;
                leftPanel.setSize(listWidth, height);
                rightPanel.setSize(listWidth, height);
                buttonsPanel.setSize(middleWidth, height);
                leftPanel.setBounds(left, top, listWidth, height);
                rightPanel.setBounds(right - listWidth, top, listWidth, height);
                buttonsPanel.setBounds(left + listWidth + gap, top, middleWidth - gap * 2, height);
            }
        }
    });
    listsPanel.add(leftPanel);
    listsPanel.add(buttonsPanel);
    listsPanel.add(rightPanel);
    add(listsPanel, BorderLayout.CENTER);
    add(myQualifierOptionsPanel, BorderLayout.EAST);
}
Also used : AbstractLayoutManager(com.intellij.util.ui.AbstractLayoutManager) JBLabel(com.intellij.ui.components.JBLabel) JBList(com.intellij.ui.components.JBList) JBScrollPane(com.intellij.ui.components.JBScrollPane) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Aggregations

VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)34 Nullable (org.jetbrains.annotations.Nullable)8 JBLabel (com.intellij.ui.components.JBLabel)7 NotNull (org.jetbrains.annotations.NotNull)6 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 EditorTextField (com.intellij.ui.EditorTextField)3 TitledSeparator (com.intellij.ui.TitledSeparator)3 JBList (com.intellij.ui.components.JBList)3 JBScrollPane (com.intellij.ui.components.JBScrollPane)3 FormBuilder (com.intellij.util.ui.FormBuilder)3 ArrayList (java.util.ArrayList)3 Document (com.intellij.openapi.editor.Document)2 ComboBox (com.intellij.openapi.ui.ComboBox)2 JBPanel (com.intellij.ui.components.JBPanel)2 JCheckBox (javax.swing.JCheckBox)2 JPanel (javax.swing.JPanel)2 Density (com.android.resources.Density)1 LegendComponent (com.android.tools.adtui.LegendComponent)1 ImageComponent (com.android.tools.idea.ui.ImageComponent)1