Java Code Examples for com.intellij.ui.components.panels.NonOpaquePanel#setLayout()

The following examples show how to use com.intellij.ui.components.panels.NonOpaquePanel#setLayout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ActionPanel(JBTabsImpl tabs, TabInfo tabInfo, Pass<MouseEvent> pass) {
  myTabs = tabs;
  ActionGroup group = tabInfo.getTabLabelActions() != null ? tabInfo.getTabLabelActions() : new DefaultActionGroup();
  AnAction[] children = group.getChildren(null);

  final NonOpaquePanel wrapper = new NonOpaquePanel(new BorderLayout());
  wrapper.add(Box.createHorizontalStrut(2), BorderLayout.WEST);
  NonOpaquePanel inner = new NonOpaquePanel();
  inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS));
  wrapper.add(inner, BorderLayout.CENTER);
  for (AnAction each : children) {
    ActionButton eachButton = new ActionButton(myTabs, tabInfo, each, tabInfo.getTabActionPlace(), pass, tabs.getTabActionsMouseDeadzone()) {
      @Override
      protected void repaintComponent(final Component c) {
        TabLabel tabLabel = (TabLabel) SwingUtilities.getAncestorOfClass(TabLabel.class, c);
        if (tabLabel != null) {
          Point point = SwingUtilities.convertPoint(c, new Point(0, 0), tabLabel);
          Dimension d = c.getSize();
          tabLabel.repaint(point.x, point.y, d.width, d.height);
        } else {
          super.repaintComponent(c);
        }
      }
    };

    myButtons.add(eachButton);
    InplaceButton component = eachButton.getComponent();
    inner.add(component);
  }

  add(wrapper);
}
 
Example 2
Source File: ProgressStripe.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) {
  parent.setLayout(new BorderLayout());

  NonOpaquePanel result = new NonOpaquePanel();
  result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));
  result.add(icon);

  parent.add(result, BorderLayout.NORTH);

  return result;
}
 
Example 3
Source File: BranchActionGroupPopup.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void createTitlePanelToolbar(@Nonnull String dimensionKey) {
  myTitleToolbarPanel = new NonOpaquePanel();
  myTitleToolbarPanel.setLayout(new BoxLayout(myTitleToolbarPanel, BoxLayout.LINE_AXIS));
  myTitleToolbarPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  myRestoreSizeButton = new MyToolbarButton("Restore Size", CollapseComponent, CollapseComponentHover, e -> {
    WindowStateService.getInstance(myProject).putSizeFor(myProject, dimensionKey, null);
    myInternalSizeChanged = true;
    pack(true, true);
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return myUserSizeChanged;
    }
  };

  mySettingsButton = new MyToolbarButton("Settings", AllIcons.General.GearPlain, null, e -> {
    final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(BRANCH_POPUP, new DefaultActionGroup(mySettingsActions));
    popupMenu.getComponent().show(mySettingsButton, 0, assertNotNull(mySettingsButton).getHeight());
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return !mySettingsActions.isEmpty();
    }
  };

  myTitleToolbarPanel.add(mySettingsButton);
  myTitleToolbarPanel.add(myRestoreSizeButton);
  getTitle().setButtonComponent(new ActiveComponent.Adapter() {
    @Nonnull
    @Override
    public JComponent getComponent() {
      return myTitleToolbarPanel;
    }
  }, JBUI.Borders.emptyRight(2));
}
 
Example 4
Source File: FlatWelcomePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
private JComponent createSettingsAndDocs() {
  JPanel panel = new NonOpaquePanel(new BorderLayout());
  NonOpaquePanel toolbar = new NonOpaquePanel();

  toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
  toolbar.add(createEventsLink());
  toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.GearPlain, true));
  toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false));

  panel.add(toolbar, BorderLayout.EAST);


  panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11));
  return panel;
}