Java 类com.intellij.ui.components.JBTabbedPane 实例源码

项目:CodeGenerate    文件:CodeMakerConfiguration.java   
public CodeMakerConfiguration(CodeMakerSettings settings) {
    tabbedPane = new JBTabbedPane();
    editPaneMap = new HashMap<>();
    addTemplateButton.addActionListener(e -> {
        TemplateEditPane editPane = new TemplateEditPane(settings, "", this);
        String title = "Untitled";
        tabbedPane.addTab(title, editPane.getTemplateEdit());
        tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
        editPaneMap.put(title, editPane);
    });
    resetTabPane(settings);
    GridConstraints constraints = new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
        GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
        GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(300, 300), null, 0, true);
    mainPane.add(tabbedPane, constraints);
}
项目:intellij-ce-playground    文件:AsmCodeGeneratorTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  myNestedFormLoader = new MyNestedFormLoader();

  final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);

  java.util.List<URL> cp = new ArrayList<URL>();
  appendPath(cp, JBTabbedPane.class);
  appendPath(cp, TIntObjectHashMap.class);
  appendPath(cp, UIUtil.class);
  appendPath(cp, SystemInfoRt.class);
  appendPath(cp, ApplicationManager.class);
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
  appendPath(cp, GridLayoutManager.class); // forms_rt
  appendPath(cp, DataProvider.class);
  myClassFinder = new MyClassFinder(
    new URL[] {new File(swingPath).toURI().toURL()},
    cp.toArray(new URL[cp.size()])
  );
}
项目:tools-idea    文件:GlassPanel.java   
@Nullable
private Area getComponentArea(final JComponent surfaceComponent, final JComponent lightComponent) {
  if (!lightComponent.isShowing()) return null;

  final Point panelPoint = SwingUtilities.convertPoint(lightComponent, new Point(0, 0), surfaceComponent);
  final int x = panelPoint.x;
  final int y = panelPoint.y;

  Insets insetsToIgnore = lightComponent.getInsets();
  final boolean isWithBorder = Boolean.TRUE.equals(lightComponent.getClientProperty(SearchUtil.HIGHLIGHT_WITH_BORDER));
  final boolean isLabelFromTabbedPane = Boolean.TRUE.equals(lightComponent.getClientProperty(JBTabbedPane.LABEL_FROM_TABBED_PANE));

  if ((insetsToIgnore == null || (UIUtil.isUnderAquaLookAndFeel() && lightComponent instanceof JButton)) || isWithBorder) {
    insetsToIgnore = EMPTY_INSETS;
  }

  int hInset = isWithBorder ? 7 : isLabelFromTabbedPane ? 20 : 7;
  int vInset = isWithBorder ? 1 : isLabelFromTabbedPane ? 10 : 5;
  final Area area = new Area(new RoundRectangle2D.Double(x - hInset + insetsToIgnore.left,
                                                         y - vInset + insetsToIgnore.top,
                                                         lightComponent.getWidth() + hInset * 2 - insetsToIgnore.right - insetsToIgnore.left,
                                                         lightComponent.getHeight() + vInset * 2 - insetsToIgnore.top - insetsToIgnore.bottom,
                                                         6, 6));
  return area;
}
项目:tools-idea    文件:AsmCodeGeneratorTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  myNestedFormLoader = new MyNestedFormLoader();

  final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);

  java.util.List<URL> cp = new ArrayList<URL>();
  appendPath(cp, JBTabbedPane.class);
  appendPath(cp, TIntObjectHashMap.class);
  appendPath(cp, UIUtil.class);
  appendPath(cp, SystemInfoRt.class);
  appendPath(cp, ApplicationManager.class);
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
  appendPath(cp, GridLayoutManager.class); // forms_rt
  myClassFinder = new MyClassFinder(
    new URL[] {new File(swingPath).toURI().toURL()},
    cp.toArray(new URL[cp.size()])
  );
}
项目:intellij-plugin-v4    文件:PreviewPanel.java   
public JTabbedPane createParseTreeAndProfileTabbedPanel() {
    JBTabbedPane tabbedPane = new JBTabbedPane();

    LOG.info("createParseTreePanel" + " " + project.getName());
    Pair<UberTreeViewer, JPanel> pair = createParseTreePanel();
    treeViewer = pair.a;
    tabbedPane.addTab("Parse tree", pair.b);

    jTreeViewer = new JTreeViewer(null, this);
    tabbedPane.addTab("Hierarchy", jTreeViewer);

    profilerPanel = new ProfilerPanel(project, this);
    tabbedPane.addTab("Profiler", profilerPanel.$$$getRootComponent$$$());

    return tabbedPane;
}
项目:consulo-ui-designer    文件:AsmCodeGeneratorTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  myNestedFormLoader = new MyNestedFormLoader();

  final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);

  java.util.List<URL> cp = new ArrayList<URL>();
  appendPath(cp, JBTabbedPane.class);
  appendPath(cp, TIntObjectHashMap.class);
  appendPath(cp, UIUtil.class);
  appendPath(cp, SystemInfoRt.class);
  appendPath(cp, ApplicationManager.class);
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/messages/UIBundle.properties"));
  appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
  appendPath(cp, GridLayoutManager.class); // forms_rt
  myClassFinder = new MyClassFinder(
    new URL[] {new File(swingPath).toURI().toURL()},
    cp.toArray(new URL[cp.size()])
  );
}
项目:consulo    文件:GlassPanel.java   
@Nullable
private Area getComponentArea(final JComponent surfaceComponent, final JComponent lightComponent) {
  if (!lightComponent.isShowing()) return null;

  final Point panelPoint = SwingUtilities.convertPoint(lightComponent, new Point(0, 0), surfaceComponent);
  final int x = panelPoint.x;
  final int y = panelPoint.y;

  Insets insetsToIgnore = lightComponent.getInsets();
  final boolean isWithBorder = Boolean.TRUE.equals(lightComponent.getClientProperty(SearchUtil.HIGHLIGHT_WITH_BORDER));
  final boolean isLabelFromTabbedPane = Boolean.TRUE.equals(lightComponent.getClientProperty(JBTabbedPane.LABEL_FROM_TABBED_PANE));

  if ((insetsToIgnore == null || (UIUtil.isUnderAquaLookAndFeel() && lightComponent instanceof JButton)) || isWithBorder) {
    insetsToIgnore = EMPTY_INSETS;
  }

  int hInset = isWithBorder ? 7 : isLabelFromTabbedPane ? 20 : 7;
  int vInset = isWithBorder ? 1 : isLabelFromTabbedPane ? 10 : 5;
  final Area area = new Area(new RoundRectangle2D.Double(x - hInset + insetsToIgnore.left,
                                                         y - vInset + insetsToIgnore.top,
                                                         lightComponent.getWidth() + hInset * 2 - insetsToIgnore.right - insetsToIgnore.left,
                                                         lightComponent.getHeight() + vInset * 2 - insetsToIgnore.top - insetsToIgnore.bottom,
                                                         6, 6));
  return area;
}
项目:CodeGen    文件:ColumnEditorFrame.java   
private void init(IdeaContext ideaContext, List<Table> tables){
    setLayout(new BorderLayout());
    JBTabbedPane tabbedPane = new JBTabbedPane();

    for (Table table: tables) {
        TablePanel tablePanel = new TablePanel(table);
        tabbedPane.add(tablePanel.getRootComponent(), table.getTableName());
        panels.add(tablePanel);
    }

    List<CodeRoot> codeRoots =  SETTING_MANAGER.getTemplates().getRoots();
    SelectGroupPanel selectGroupPanel = new SelectGroupPanel(codeRoots, ideaContext.getProject());
    JPanel groupPanel = selectGroupPanel.getGroupsPanel();
    JButton genBtn = selectGroupPanel.getGenerator();
    groupPathMap = selectGroupPanel.getGroupPathMap();
    genBtn.addActionListener( it -> {
        List<String> selectGroups = new ArrayList<>();
        this.getAllJCheckBoxValue(groupPanel, selectGroups);

        if(!selectGroups.isEmpty()) {
            List<CodeContext> contexts = new ArrayList<>();

            for (TablePanel panel: panels) {
                String modelName = panel.getModelTextField().getText().trim();
                String tableName = panel.getTableTextField().getText().trim();
                String comment = panel.getCommentTextField().getText().trim();
                // 组装数据
                CodeContext context = new CodeContext(modelName, tableName, comment, panel.getFields());
                contexts.add(context);
            }
            generator(ideaContext, selectGroups, contexts);
            dispose();
        }
    });

    add(tabbedPane, BorderLayout.CENTER);
    selectGroupPanel.getRootPanel().setBorder(BorderFactory.createEmptyBorder(0, 15, 10, 15));
    add(selectGroupPanel.getRootPanel(), BorderLayout.SOUTH);
}
项目:intellij-ce-playground    文件:UnusedDeclarationInspection.java   
@Override
public JComponent createOptionsPanel() {
  JTabbedPane tabs = new JBTabbedPane(SwingConstants.TOP);
  tabs.add("Entry points", new OptionsPanel());
  tabs.add("On the fly editor settings", myLocalInspectionBase.createOptionsPanel());
  return tabs;
}
项目:intellij-ce-playground    文件:GroupSettingsBuilder.java   
private JComponent doCreateComponent() {
  List<Pair<String,SettingsEditor<T>>> editors = myGroup.getEditors();
  if (editors.size() == 0) return new JPanel();
  if (editors.size() == 1) return editors.get(0).getSecond().getComponent();

  JTabbedPane tabs = new JBTabbedPane();
  for (int i = 0; i < editors.size(); i++) {
    Pair<String, SettingsEditor<T>> pair = editors.get(i);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(pair.getSecond().getComponent(), BorderLayout.CENTER);
    tabs.add(pair.getFirst(), panel);
  }

  return tabs;
}
项目:intellij-ce-playground    文件:GlassPanel.java   
@Nullable
private Area getComponentArea(final JComponent surfaceComponent, final JComponent lightComponent, int offset) {
  if (!lightComponent.isShowing()) return null;

  final Point panelPoint = SwingUtilities.convertPoint(lightComponent, new Point(0, 0), surfaceComponent);
  final int x = panelPoint.x;
  final int y = panelPoint.y;

  Insets insetsToIgnore = lightComponent.getInsets();
  final boolean isWithBorder = Boolean.TRUE.equals(lightComponent.getClientProperty(SearchUtil.HIGHLIGHT_WITH_BORDER));
  final boolean isLabelFromTabbedPane = Boolean.TRUE.equals(lightComponent.getClientProperty(JBTabbedPane.LABEL_FROM_TABBED_PANE));

  if ((insetsToIgnore == null || (UIUtil.isUnderAquaLookAndFeel() && lightComponent instanceof JButton)) || isWithBorder) {
    insetsToIgnore = EMPTY_INSETS;
  }

  int hInset = getComponentHInset(isWithBorder, isLabelFromTabbedPane);
  int vInset = getComponentVInset(isWithBorder, isLabelFromTabbedPane);
  hInset += offset;
  vInset += offset;
  int xCoord = x - hInset + insetsToIgnore.left;
  int yCoord = y - vInset + insetsToIgnore.top;
  int width = lightComponent.getWidth() + hInset * 2 - insetsToIgnore.right - insetsToIgnore.left;
  int height = lightComponent.getHeight() + vInset * 2 - insetsToIgnore.top - insetsToIgnore.bottom;
  return new Area(new RoundRectangle2D.Double(xCoord,
                                              yCoord,
                                              width,
                                              height,
                                              Math.min(height, 30), Math.min(height, 30)));
}
项目:intellij-ce-playground    文件:CompositeConfigurable.java   
public JComponent createComponent() {
  tabbedPane = new JBTabbedPane();
  for (Configurable configurable : configurables) {
    JComponent component = configurable.createComponent();
    tabbedPane.add(configurable.getDisplayName(), component);
  }
  return tabbedPane;
}
项目:intellij-ce-playground    文件:SvnConfigureProxiesDialog.java   
protected JComponent createCenterPanel() {
  myTabbedPane = new JBTabbedPane();
  myTabbedPane.add(myUserTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.user.file.title"));
  myTabbedPane.add(mySystemTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.system.file.title"));
  myPanel.add(myTabbedPane, BorderLayout.NORTH);
  return myPanel;
}
项目:aem-ide-tooling-4-intellij    文件:SlingPluginToolWindowFactory.java   
public void createToolWindowContent(final Project project, final ToolWindow toolWindow) {
    // Plugin is now placed into a Tabbed Pane to add additional views to it
    JBTabbedPane master = new JBTabbedPane(SwingConstants.BOTTOM);
    SlingPluginExplorer explorer = new SlingPluginExplorer(project);
    LOGGER.debug("CTWC: Explorer: '" + explorer + "'");
    master.insertTab("Plugin", null, explorer, "Plugin Windows", 0);

    WebContentFXPanel info = new WebContentFXPanel();
    master.insertTab("Info", null, info, "Plugin Info", 1);

    final AemdcPanel aemdcPanel = ComponentProvider.getComponent(project, AemdcPanel.class);
    LOGGER.debug("AEMDC Panel found: '{}'", aemdcPanel);
    aemdcPanel.setContainer(master);

    final ContentManager contentManager = toolWindow.getContentManager();
    final Content content = contentManager.getFactory().createContent(master, null, false);
    contentManager.addContent(content);
    Disposer.register(project, explorer);

    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (toolWindow.isDisposed()) {
                return;
            }
            boolean visible = toolWindow.isVisible();
            // If the Plugin became visible then we let the AEMDC Panel know to recrate the JFX Panel
            // to avoid the double buffering
            if(!wasVisible && visible) {
                aemdcPanel.reset();
            }
            wasVisible = visible;
        }
    };
    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(project);
    manager.addToolWindowManagerListener(listener, project);
}
项目:tools-idea    文件:GroupSettingsBuilder.java   
private JComponent doCreateComponent() {
  List<Pair<String,SettingsEditor<T>>> editors = myGroup.getEditors();
  if (editors.size() == 0) return new JPanel();
  if (editors.size() == 1) return editors.get(0).getSecond().getComponent();

  JTabbedPane tabs = new JBTabbedPane();
  for (int i = 0; i < editors.size(); i++) {
    Pair<String, SettingsEditor<T>> pair = editors.get(i);
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(pair.getSecond().getComponent(), BorderLayout.CENTER);
    tabs.add(pair.getFirst(), panel);
  }

  return tabs;
}
项目:tools-idea    文件:MultilanguageCodeStyleAbstractPanel.java   
@Override
protected void installPreviewPanel(final JPanel previewPanel) {
  if (getSettingsType() != LanguageCodeStyleSettingsProvider.SettingsType.LANGUAGE_SPECIFIC) {
    tabbedPane = new JBTabbedPane();
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    Language[] langs = LanguageCodeStyleSettingsProvider.getLanguagesWithSharedPreview();
    if (langs.length == 0) return;
    for (Language lang : langs) {
      tabbedPane.addTab(getTabName(lang), createDummy());
    }
    tabbedPane.setComponentAt(0, getEditor().getComponent());
    myLangSelectionIndex = 0;
    if (myLanguage == null) {
      setPanelLanguage(langs[0]);
    }
    else {
      updatePreview(true);
    }
    tabbedPane.addChangeListener(new ChangeListener() {
      @Override
      public void stateChanged(ChangeEvent e) {
        onTabSelection((JTabbedPane)e.getSource());
      }
    });
    previewPanel.add(tabbedPane, BorderLayout.CENTER);
    previewPanel.addAncestorListener(new AncestorListenerAdapter() {
      @Override
      public void ancestorAdded(AncestorEvent event) {
        selectCurrentLanguageTab();
      }
    });
  }
  else {
    // If settings are language-specific
    previewPanel.add(getEditor().getComponent(), BorderLayout.CENTER);
    updatePreview(true);
  }
}
项目:tools-idea    文件:CompositeConfigurable.java   
public JComponent createComponent() {
  tabbedPane = new JBTabbedPane();
  for (Configurable configurable : configurables) {
    JComponent component = configurable.createComponent();
    tabbedPane.add(configurable.getDisplayName(), component);
  }
  return tabbedPane;
}
项目:tools-idea    文件:SvnConfigureProxiesDialog.java   
protected JComponent createCenterPanel() {
  myTabbedPane = new JBTabbedPane();
  myTabbedPane.add(myUserTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.user.file.title"));
  myTabbedPane.add(mySystemTab.createComponent(), SvnBundle.message("dialog.edit.http.proxies.settings.tab.edit.system.file.title"));
  myPanel.add(myTabbedPane, BorderLayout.NORTH);
  return myPanel;
}
项目:consulo-java    文件:UnusedDeclarationInspection.java   
@Override
public JComponent createOptionsPanel()
{
    JTabbedPane tabs = new JBTabbedPane(SwingConstants.TOP);
    tabs.add("Entry points", new OptionsPanel());
    tabs.add("On the fly editor settings", myLocalInspectionBase.createOptionsPanel());
    return tabs;
}
项目:intellij-ce-playground    文件:TabbedRefreshablePanel.java   
public TabbedRefreshablePanel() {
  myPanels = new ArrayList<RefreshablePanel>();
  myPane = new JBTabbedPane();
  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myPane, BorderLayout.CENTER);
}
项目:aem-ide-tooling-4-intellij    文件:AemdcPanel.java   
public void setContainer(JBTabbedPane container) {
    this.container = container;
}
项目:tools-idea    文件:TabbedRefreshablePanel.java   
public TabbedRefreshablePanel() {
  myPanels = new ArrayList<RefreshablePanel>();
  myPane = new JBTabbedPane();
  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myPane, BorderLayout.CENTER);
}
项目:consulo    文件:TabbedRefreshablePanel.java   
public TabbedRefreshablePanel() {
  myPanels = new ArrayList<RefreshablePanel>();
  myPane = new JBTabbedPane();
  myPanel = new JPanel(new BorderLayout());
  myPanel.add(myPane, BorderLayout.CENTER);
}