Search in sources :

Example 31 with JBScrollPane

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

the class ChooseActivityTypeStep method init.

private void init(@NotNull List<TemplateHandle> templateList, @NotNull List<AndroidSourceSet> sourceSets, @Nullable AndroidFacet facet) {
    myTemplateList = templateList.toArray(new TemplateHandle[templateList.size()]);
    mySourceSets = sourceSets;
    myActivityGallery = createGallery(getTitle());
    myRootPanel = new JBScrollPane(myActivityGallery);
    FormScalingUtil.scaleComponentTree(this.getClass(), myRootPanel);
    myFacet = facet;
}
Also used : JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 32 with JBScrollPane

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

the class MonitorContentFactory method createMonitorContent.

public static void createMonitorContent(@NotNull final Project project, @NotNull DeviceContext deviceContext, @NotNull RunnerLayoutUi layoutUi) {
    BaseMonitorView[] monitors = new BaseMonitorView[] { new CpuMonitorView(project, deviceContext), new MemoryMonitorView(project, deviceContext), new NetworkMonitorView(project, deviceContext), new GpuMonitorView(project, deviceContext) };
    MonitorPanel monitorPanel = new MonitorPanel(monitors);
    JBScrollPane monitorScrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    monitorScrollPane.setViewportView(monitorPanel);
    monitorScrollPane.getVerticalScrollBar().setUnitIncrement(10);
    monitorScrollPane.getHorizontalScrollBar().setUnitIncrement(10);
    Content monitorContent = layoutUi.createContent("Monitors", monitorScrollPane, "Monitors", null, null);
    monitorContent.setCloseable(false);
    layoutUi.addContent(monitorContent);
}
Also used : NetworkMonitorView(com.android.tools.idea.monitor.network.NetworkMonitorView) GpuMonitorView(com.android.tools.idea.monitor.gpu.GpuMonitorView) MemoryMonitorView(com.android.tools.idea.monitor.memory.MemoryMonitorView) Content(com.intellij.ui.content.Content) CpuMonitorView(com.android.tools.idea.monitor.cpu.CpuMonitorView) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 33 with JBScrollPane

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

the class ChooseModuleTypeStep method createGallery.

private JPanel createGallery() {
    Dimension thumbnailSize = DEFAULT_GALLERY_THUMBNAIL_SIZE;
    myFormFactorGallery = new ASGallery<ModuleTemplate>(JBList.createDefaultListModel(), new Function<ModuleTemplate, Image>() {

        @Override
        public Image apply(ModuleTemplate input) {
            return IconUtil.toImage(input.getIcon());
        }
    }, new Function<ModuleTemplate, String>() {

        @Override
        public String apply(@Nullable ModuleTemplate input) {
            return input == null ? "<none>" : input.getName();
        }
    }, thumbnailSize, new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DynamicWizard wizard = getWizard();
            assert wizard != null;
            getWizard().doNextAction();
        }
    }) {

        @Override
        public Dimension getPreferredScrollableViewportSize() {
            Dimension preferred = getPreferredSize();
            int heightInsets = getInsets().top + getInsets().bottom;
            // Don't want to show an exact number of rows, since then it's not obvious there's another row available.
            return new Dimension(preferred.width, (int) (computeCellSize().height * 2.2) + heightInsets);
        }
    };
    myFormFactorGallery.setMinimumSize(new Dimension(thumbnailSize.width * 2 + 1, thumbnailSize.height));
    myFormFactorGallery.setBorder(BorderFactory.createLineBorder(JBColor.border()));
    AccessibleContext accessibleContext = myFormFactorGallery.getAccessibleContext();
    if (accessibleContext != null) {
        accessibleContext.setAccessibleDescription(getStepTitle());
    }
    JPanel panel = new JPanel(new JBCardLayout());
    panel.add("only card", new JBScrollPane(myFormFactorGallery));
    return panel;
}
Also used : AccessibleContext(javax.accessibility.AccessibleContext) ModuleTemplate(com.android.tools.idea.npw.ModuleTemplate) ActionEvent(java.awt.event.ActionEvent) Function(com.google.common.base.Function) DynamicWizard(com.android.tools.idea.wizard.dynamic.DynamicWizard) JBCardLayout(com.intellij.ui.JBCardLayout) Nullable(org.jetbrains.annotations.Nullable) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 34 with JBScrollPane

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

the class ImportDependenciesDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    final JBScrollPane pane = new JBScrollPane(myCheckBoxList);
    pane.setPreferredSize(JBUI.size(500, 200));
    return pane;
}
Also used : JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 35 with JBScrollPane

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

the class ShowNonRetinaImagesActions method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return;
    class ImageInfo {

        boolean retina;

        boolean normal;

        boolean dark;

        boolean retina_dark;
    }
    HashMap<String, ImageInfo> info = new HashMap<>();
    final Collection<VirtualFile> images = FilenameIndex.getAllFilesByExt(project, "png", GlobalSearchScope.projectScope(project));
    for (VirtualFile image : images) {
        final String path = image.getPath();
        final String key = toKey(path);
        ImageInfo imageInfo = info.get(key);
        if (imageInfo == null) {
            imageInfo = new ImageInfo();
            info.put(key, imageInfo);
        }
        if (path.endsWith("@2x_dark.png")) {
            imageInfo.retina_dark = true;
        } else if (path.endsWith("_dark.png")) {
            imageInfo.dark = true;
        } else if (path.endsWith("@2x.png")) {
            imageInfo.retina = true;
        } else {
            imageInfo.normal = true;
        }
    }
    final ArrayList<String> retinaMissed = new ArrayList<>();
    for (String key : info.keySet()) {
        if (!info.get(key).retina && info.get(key).normal) {
            retinaMissed.add(key);
        }
    }
    Collections.sort(retinaMissed, String.CASE_INSENSITIVE_ORDER);
    new DialogWrapper(project) {

        {
            init();
        }

        @Nullable
        @Override
        protected JComponent createCenterPanel() {
            return new JBScrollPane(new JTextArea(StringUtil.join(retinaMissed, "\n")));
        }
    }.show();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) Nullable(org.jetbrains.annotations.Nullable) JBScrollPane(com.intellij.ui.components.JBScrollPane)

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