Search in sources :

Example 26 with VerticalFlowLayout

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

the class RestoreReferencesDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
    myList = new JBList(myNamedElements);
    myList.setCellRenderer(new KotlinImportListRenderer());
    panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);
    panel.add(new JBLabel(myContainsClassesOnly ? CodeInsightBundle.message("dialog.paste.on.import.text") : CodeInsightBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), BorderLayout.NORTH);
    final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
    final JButton okButton = new JButton(CommonBundle.getOkButtonText());
    getRootPane().setDefaultButton(okButton);
    buttonPanel.add(okButton);
    final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
    buttonPanel.add(cancelButton);
    panel.setPreferredSize(new Dimension(500, 400));
    return panel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) JBList(com.intellij.ui.components.JBList) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 27 with VerticalFlowLayout

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

the class StudyNewProjectPanel method layoutPanel.

private void layoutPanel() {
    myCoursesComboBox = new ComboBox<>();
    final LabeledComponent<ComboBox> coursesCombo = LabeledComponent.create(myCoursesComboBox, "Courses:", BorderLayout.WEST);
    myRefreshButton = new FixedSizeButton(coursesCombo);
    if (SystemInfo.isMac && !UIUtil.isUnderDarcula())
        myRefreshButton.putClientProperty("JButton.buttonType", null);
    myRefreshButton.setIcon(AllIcons.Actions.Refresh);
    myBrowseButton = new FixedSizeButton(coursesCombo);
    final JPanel comboPanel = new JPanel(new BorderLayout());
    comboPanel.add(coursesCombo, BorderLayout.CENTER);
    comboPanel.add(myRefreshButton, BorderLayout.EAST);
    final JPanel coursesPanel = new JPanel(new BorderLayout());
    coursesPanel.add(comboPanel, BorderLayout.CENTER);
    coursesPanel.add(myBrowseButton, BorderLayout.EAST);
    add(coursesPanel);
    myAnchor = coursesCombo;
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel invisibleLabel = new JLabel();
    invisibleLabel.setPreferredSize(new JLabel("Location: ").getPreferredSize());
    panel.add(invisibleLabel, BorderLayout.WEST);
    myInfoPanel = new JPanel(new VerticalFlowLayout());
    myAuthorLabel = new JLabel();
    myDescriptionPane = new JTextPane();
    myDescriptionPane.setEditable(true);
    myDescriptionPane.setEnabled(true);
    myAuthorLabel.setEnabled(true);
    myDescriptionPane.setPreferredSize(new Dimension(150, 200));
    myDescriptionPane.setFont(coursesCombo.getFont());
    myInfoPanel.add(myAuthorLabel);
    myInfoPanel.add(new JBScrollPane(myDescriptionPane));
    panel.add(myInfoPanel, BorderLayout.CENTER);
    add(panel);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton) JBScrollPane(com.intellij.ui.components.JBScrollPane) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 28 with VerticalFlowLayout

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

the class PyChangeSignatureDialog method getTableEditor.

@Override
protected JBTableRowEditor getTableEditor(final JTable t, final ParameterTableModelItemBase<PyParameterInfo> item) {
    return new JBTableRowEditor() {

        private EditorTextField myNameEditor;

        private EditorTextField myDefaultValueEditor;

        private JCheckBox myDefaultInSignature;

        @Override
        public void prepareEditor(JTable table, int row) {
            setLayout(new GridLayout(1, 3));
            final JPanel parameterPanel = createParameterPanel();
            add(parameterPanel);
            final JPanel defaultValuePanel = createDefaultValuePanel();
            add(defaultValuePanel);
            final JPanel defaultValueCheckBox = createDefaultValueCheckBox();
            add(defaultValueCheckBox);
            final String nameText = myNameEditor.getText();
            myDefaultValueEditor.setEnabled(!nameText.startsWith("*") && !PyNames.CANONICAL_SELF.equals(nameText));
            myDefaultInSignature.setEnabled(!nameText.startsWith("*") && !PyNames.CANONICAL_SELF.equals(nameText));
        }

        private JPanel createDefaultValueCheckBox() {
            final JPanel defaultValuePanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 2, true, false));
            final JBLabel inSignatureLabel = new JBLabel(PyBundle.message("refactoring.change.signature.dialog.default.value.checkbox"), UIUtil.ComponentStyle.SMALL);
            IJSwingUtilities.adjustComponentsOnMac(inSignatureLabel, myDefaultInSignature);
            defaultValuePanel.add(inSignatureLabel, BorderLayout.WEST);
            myDefaultInSignature = new JCheckBox();
            myDefaultInSignature.setSelected(((PyParameterTableModelItem) item).isDefaultInSignature());
            myDefaultInSignature.addItemListener(new ItemListener() {

                @Override
                public void itemStateChanged(ItemEvent event) {
                    ((PyParameterTableModelItem) item).setDefaultInSignature(myDefaultInSignature.isSelected());
                }
            });
            myDefaultInSignature.addChangeListener(mySignatureUpdater);
            myDefaultInSignature.setEnabled(item.parameter.getOldIndex() == -1);
            defaultValuePanel.add(myDefaultInSignature, BorderLayout.EAST);
            return defaultValuePanel;
        }

        private JPanel createDefaultValuePanel() {
            final JPanel defaultValuePanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 2, true, false));
            final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(item.defaultValueCodeFragment);
            myDefaultValueEditor = new EditorTextField(doc, getProject(), getFileType());
            final JBLabel defaultValueLabel = new JBLabel(PyBundle.message("refactoring.change.signature.dialog.default.value.label"), UIUtil.ComponentStyle.SMALL);
            IJSwingUtilities.adjustComponentsOnMac(defaultValueLabel, myDefaultValueEditor);
            defaultValuePanel.add(defaultValueLabel);
            defaultValuePanel.add(myDefaultValueEditor);
            myDefaultValueEditor.setPreferredWidth(t.getWidth() / 2);
            myDefaultValueEditor.addDocumentListener(mySignatureUpdater);
            return defaultValuePanel;
        }

        private JPanel createParameterPanel() {
            final JPanel namePanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 2, true, false));
            myNameEditor = new EditorTextField(item.parameter.getName(), getProject(), getFileType());
            final JBLabel nameLabel = new JBLabel(PyBundle.message("refactoring.change.signature.dialog.name.label"), UIUtil.ComponentStyle.SMALL);
            IJSwingUtilities.adjustComponentsOnMac(nameLabel, myNameEditor);
            namePanel.add(nameLabel);
            namePanel.add(myNameEditor);
            myNameEditor.setPreferredWidth(t.getWidth() / 2);
            myNameEditor.addDocumentListener(new DocumentAdapter() {

                @Override
                public void documentChanged(DocumentEvent event) {
                    fireDocumentChanged(event, 0);
                    myDefaultValueEditor.setEnabled(!myNameEditor.getText().startsWith("*"));
                    myDefaultInSignature.setEnabled(!myNameEditor.getText().startsWith("*"));
                }
            });
            myNameEditor.addDocumentListener(mySignatureUpdater);
            return namePanel;
        }

        @Override
        public JBTableRow getValue() {
            return new JBTableRow() {

                @Override
                public Object getValueAt(int column) {
                    switch(column) {
                        case 0:
                            return myNameEditor.getText().trim();
                        case 1:
                            return new Pair<>(item.defaultValueCodeFragment, ((PyParameterTableModelItem) item).isDefaultInSignature());
                    }
                    return null;
                }
            };
        }

        @Override
        public JComponent getPreferredFocusedComponent() {
            return myNameEditor.getFocusTarget();
        }

        @Override
        public JComponent[] getFocusableComponents() {
            final List<JComponent> focusable = new ArrayList<>();
            focusable.add(myNameEditor.getFocusTarget());
            if (myDefaultValueEditor != null) {
                focusable.add(myDefaultValueEditor.getFocusTarget());
            }
            return focusable.toArray(new JComponent[focusable.size()]);
        }
    };
}
Also used : ItemEvent(java.awt.event.ItemEvent) ArrayList(java.util.ArrayList) DocumentAdapter(com.intellij.openapi.editor.event.DocumentAdapter) Document(com.intellij.openapi.editor.Document) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) JBTableRowEditor(com.intellij.util.ui.table.JBTableRowEditor) EditorTextField(com.intellij.ui.EditorTextField) JBLabel(com.intellij.ui.components.JBLabel) ItemListener(java.awt.event.ItemListener) JBTableRow(com.intellij.util.ui.table.JBTableRow) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Pair(com.intellij.openapi.util.Pair)

Example 29 with VerticalFlowLayout

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

the class IpnbCodePanel method createViewPanel.

@Override
protected JComponent createViewPanel() {
    final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP));
    panel.setBackground(IpnbEditorUtil.getBackground());
    panel.add(createCodeComponent());
    myHideableOutputPanel = new HideableOutputPanel();
    panel.add(myHideableOutputPanel);
    return panel;
}
Also used : VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 30 with VerticalFlowLayout

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

the class IpnbCodePanel method createOutputPanel.

@NotNull
private JPanel createOutputPanel() {
    final JPanel outputPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, true, false));
    outputPanel.setBackground(IpnbEditorUtil.getBackground());
    for (IpnbOutputCell outputCell : myCell.getCellOutputs()) {
        addOutputPanel(outputPanel, outputCell, outputCell instanceof IpnbOutOutputCell);
    }
    return outputPanel;
}
Also used : VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) NotNull(org.jetbrains.annotations.NotNull)

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