Search in sources :

Example 26 with JBScrollPane

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

the class DeepLinkChooserDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    JScrollPane scrollPane = new JBScrollPane(myList);
    myList.setSelectedIndex(0);
    new DoubleClickListener() {

        @Override
        protected boolean onDoubleClick(MouseEvent e) {
            int index = myList.locationToIndex(e.getPoint());
            if (index != -1 && myList.getModel().getElementAt(index) != null) {
                myList.setSelectedIndex(index);
                doOKAction();
            }
            return false;
        }
    }.installOn(myList);
    return scrollPane;
}
Also used : MouseEvent(java.awt.event.MouseEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener) JBScrollPane(com.intellij.ui.components.JBScrollPane) Nullable(org.jetbrains.annotations.Nullable)

Example 27 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project azure-tools-for-java by Microsoft.

the class ActivityLogToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    this.project = project;
    table = new TableView<DeploymentTableItem>(new ListTableModel<DeploymentTableItem>(DESC, PROGRESS, STATUS, START_TIME));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // add mouse listener for links in table
    table.addMouseListener(createTableMouseListener());
    toolWindow.getComponent().add(new JBScrollPane(table));
    registerDeploymentListener();
}
Also used : ListTableModel(com.intellij.util.ui.ListTableModel) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 28 with JBScrollPane

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

the class ThreadsSegment method setCenterContent.

@Override
protected void setCenterContent(@NotNull JPanel panel) {
    JLayeredPane centerPane = new JBLayeredPane();
    JScrollPane scrollPane = new JBScrollPane(mThreadsList);
    centerPane.add(scrollPane);
    centerPane.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            JLayeredPane host = (JLayeredPane) e.getComponent();
            if (host != null) {
                Dimension dim = host.getSize();
                for (Component c : host.getComponents()) {
                    c.setBounds(0, 0, dim.width, dim.height);
                }
            }
        }
    });
    panel.add(centerPane, BorderLayout.CENTER);
}
Also used : JBLayeredPane(com.intellij.ui.components.JBLayeredPane) ComponentEvent(java.awt.event.ComponentEvent) LegendComponent(com.android.tools.adtui.LegendComponent) AnimatedComponent(com.android.tools.adtui.AnimatedComponent) JBScrollPane(com.intellij.ui.components.JBScrollPane) ComponentAdapter(java.awt.event.ComponentAdapter)

Example 29 with JBScrollPane

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

the class NetworkCaptureSegment method setCenterContent.

@Override
protected void setCenterContent(@NotNull JPanel panel) {
    myCaptureTable = createCaptureTable();
    panel.add(new JBScrollPane(myCaptureTable), BorderLayout.CENTER);
}
Also used : JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 30 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane 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

JBScrollPane (com.intellij.ui.components.JBScrollPane)51 ActionEvent (java.awt.event.ActionEvent)7 Nullable (org.jetbrains.annotations.Nullable)7 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 JBList (com.intellij.ui.components.JBList)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 ListSelectionListener (javax.swing.event.ListSelectionListener)5 JBTable (com.intellij.ui.table.JBTable)4 Tree (com.intellij.ui.treeStructure.Tree)4 java.awt (java.awt)4 MouseEvent (java.awt.event.MouseEvent)4 List (java.util.List)4 javax.swing (javax.swing)4 TreePath (javax.swing.tree.TreePath)4 NotNull (org.jetbrains.annotations.NotNull)4 Module (com.intellij.openapi.module.Module)3 Project (com.intellij.openapi.project.Project)3 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)3 StringUtil (com.intellij.openapi.util.text.StringUtil)3