use of com.intellij.ui.components.JBTabbedPane in project intellij-plugins by JetBrains.
the class JstdRunConfigurationEditor method createTabbedPane.
@NotNull
private static JBTabbedPane createTabbedPane(@NotNull Project project, @NotNull Map<String, RunSettingsSection> tabs) {
JBTabbedPane tabbedPane = new JBTabbedPane();
CreationContext content = new CreationContext(project);
for (Map.Entry<String, RunSettingsSection> entry : tabs.entrySet()) {
JComponent component = entry.getValue().getComponent(content);
tabbedPane.addTab(entry.getKey(), component);
}
tabbedPane.setSelectedIndex(0);
return tabbedPane;
}
use of com.intellij.ui.components.JBTabbedPane in project intellij-community by JetBrains.
the class UsageViewImpl method setupCentralPanel.
private void setupCentralPanel() {
ApplicationManager.getApplication().assertIsDispatchThread();
myCentralPanel.removeAll();
disposeUsageContextPanels();
JScrollPane treePane = ScrollPaneFactory.createScrollPane(myTree);
// add reaction to scrolling:
// since the UsageViewTreeCellRenderer ignores invisible nodes (outside the viewport), their preferred size is incorrect
// and we need to recalculate them when the node scrolled into the visible rectangle
treePane.getViewport().addChangeListener(__ -> clearRendererCache());
myPreviewSplitter = new Splitter(false, 0.5f, 0.1f, 0.9f);
myPreviewSplitter.setFirstComponent(treePane);
myCentralPanel.add(myPreviewSplitter, BorderLayout.CENTER);
if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) {
myPreviewSplitter.setProportion(UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
treePane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT);
final JBTabbedPane tabbedPane = new JBTabbedPane(SwingConstants.BOTTOM) {
@NotNull
@Override
protected Insets getInsetsForTabComponent() {
return new Insets(0, 0, 0, 0);
}
};
UsageContextPanel.Provider[] extensions = Extensions.getExtensions(UsageContextPanel.Provider.EP_NAME, myProject);
myUsageContextPanelProviders = ContainerUtil.filter(extensions, provider -> provider.isAvailableFor(this));
for (UsageContextPanel.Provider provider : myUsageContextPanelProviders) {
JComponent component;
if (myCurrentUsageContextProvider == null || myCurrentUsageContextProvider == provider) {
myCurrentUsageContextProvider = provider;
myCurrentUsageContextPanel = provider.create(this);
component = myCurrentUsageContextPanel.createComponent();
} else {
component = new JLabel();
}
tabbedPane.addTab(provider.getTabTitle(), component);
}
int index = myUsageContextPanelProviders.indexOf(myCurrentUsageContextProvider);
tabbedPane.setSelectedIndex(index);
tabbedPane.addChangeListener(e -> {
int currentIndex = tabbedPane.getSelectedIndex();
UsageContextPanel.Provider selectedProvider = myUsageContextPanelProviders.get(currentIndex);
if (selectedProvider != myCurrentUsageContextProvider) {
tabSelected(selectedProvider);
}
});
tabbedPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myPreviewSplitter.setSecondComponent(tabbedPane);
} else {
myPreviewSplitter.setProportion(1);
}
myCentralPanel.add(myAdditionalComponent, BorderLayout.SOUTH);
myAdditionalComponent.add(myButtonPanel, BorderLayout.SOUTH);
myRootPanel.revalidate();
myRootPanel.repaint();
}
use of com.intellij.ui.components.JBTabbedPane in project intellij-community by JetBrains.
the class DnDDemo method main.
public static void main(String[] args) {
JFrame frame = new JFrame("DnD Demo");
frame.getContentPane().setLayout(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout());
final JTree source = new Tree();
panel.add(source, BorderLayout.WEST);
final DnDManager dndManager = new DnDManagerImpl(null);
dndManager.registerSource(new DnDSource() {
public boolean canStartDragging(DnDAction action, Point dragOrigin) {
return true;
}
public DnDDragStartBean startDragging(DnDAction action, Point point) {
return new DnDDragStartBean(source.getLastSelectedPathComponent().toString());
}
@Nullable
public Pair<Image, Point> createDraggedImage(DnDAction action, Point dragOrigin) {
return null;
}
public void dragDropEnd() {
}
public void dropActionChanged(final int gestureModifiers) {
}
}, source);
JTabbedPane tabs = new JBTabbedPane();
JPanel delegates = new JPanel(new FlowLayout());
final JLabel delegate1Label = new JLabel("Delegate 1");
delegates.add(delegate1Label);
final JLabel delegate2Label = new JLabel("Delegate 2");
delegates.add(delegate2Label);
final DnDTarget delegee1 = new DnDTarget() {
public boolean update(DnDEvent aEvent) {
aEvent.setDropPossible(true, "Delegee 1");
aEvent.setHighlighting(delegate1Label, H_ARROWS | RECTANGLE);
return false;
}
public void drop(DnDEvent aEvent) {
System.out.println("Delegee 1 accepted drop");
}
public void cleanUpOnLeave() {
}
public void updateDraggedImage(Image image, Point dropPoint, Point imageOffset) {
}
};
final DnDTarget delegee2 = new DnDTarget() {
public boolean update(DnDEvent aEvent) {
aEvent.setDropPossible("Delegee 2", new DropActionHandler() {
public void performDrop(DnDEvent aEvent) {
System.out.println("Delegee 2 accepted drop");
}
});
aEvent.setHighlighting(delegate2Label, V_ARROWS | RECTANGLE);
return false;
}
public void drop(DnDEvent aEvent) {
}
public void cleanUpOnLeave() {
}
public void updateDraggedImage(Image image, Point dropPoint, Point imageOffset) {
}
};
dndManager.registerTarget(new DnDTarget() {
public boolean update(DnDEvent aEvent) {
if (aEvent.getCurrentOverComponent() == delegate1Label) {
return aEvent.delegateUpdateTo(delegee1);
} else if (aEvent.getCurrentOverComponent() == delegate2Label) {
return aEvent.delegateUpdateTo(delegee2);
}
aEvent.setDropPossible(false, "Nothing can be dropped here");
return false;
}
public void drop(DnDEvent aEvent) {
if (aEvent.getCurrentOverComponent() == delegate1Label) {
aEvent.delegateDropTo(delegee1);
}
}
public void cleanUpOnLeave() {
}
public void updateDraggedImage(Image image, Point dropPoint, Point imageOffset) {
}
}, delegates);
tabs.add("Delegates", delegates);
final JPanel xy = new JPanel();
dndManager.registerTarget(new DnDTarget() {
public boolean update(DnDEvent aEvent) {
aEvent.setDropPossible(true, "Drop to " + asXyString(aEvent));
return false;
}
public void drop(DnDEvent aEvent) {
System.out.println("Droppped to " + asXyString(aEvent));
}
public void cleanUpOnLeave() {
}
public void updateDraggedImage(Image image, Point dropPoint, Point imageOffset) {
}
}, xy);
tabs.add("XY drop", xy);
panel.add(tabs, BorderLayout.CENTER);
frame.getContentPane().add(panel, BorderLayout.CENTER);
frame.setBounds(100, 100, 500, 500);
frame.show();
}
use of com.intellij.ui.components.JBTabbedPane in project intellij-community by JetBrains.
the class CompositeConfigurable method createComponent.
public JComponent createComponent() {
tabbedPane = new JBTabbedPane();
for (Configurable configurable : configurables) {
JComponent component = configurable.createComponent();
tabbedPane.add(configurable.getDisplayName(), component);
}
return tabbedPane;
}
Aggregations