com.intellij.util.ui.JBDimension Java Examples

The following examples show how to use com.intellij.util.ui.JBDimension. 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: MultilinePopupBuilder.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
          .setCancelOnClickOutside(true)
          .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
          .setRequestFocus(true)
          .setResizable(true)
          .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new JBDimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
 
Example #2
Source File: NewRecentProjectPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public NewRecentProjectPanel(Disposable parentDisposable, boolean welcomeScreen) {
  super(parentDisposable);

  myRootPanel.setBorder(JBUI.Borders.empty());
  if(welcomeScreen) {
    myRootPanel.setBackground(SwingUIDecorator.get(SwingUIDecorator::getSidebarColor));

    myScrollPane.setOpaque(false);
    myScrollPane.getViewport().setOpaque(false);
    myTargetComponent.setOpaque(false);
    myList.setOpaque(false);

    JBDimension size = JBUI.size(300, 460);
    myScrollPane.setSize(size);
    myScrollPane.setMinimumSize(size);
    myScrollPane.setPreferredSize(size);
  }
}
 
Example #3
Source File: DarculaSliderUI.java    From Darcula with Apache License 2.0 5 votes vote down vote up
@Override
protected Dimension getThumbSize() {
  if (isPlainThumb()) {
    return new Dimension(JBUI.scale(20), JBUI.scale(20));
  }
  return slider.getOrientation() == JSlider.HORIZONTAL ? new JBDimension(12, 20) : new JBDimension(20, 12);
}
 
Example #4
Source File: BalloonLayoutConfiguration.java    From consulo with Apache License 2.0 5 votes vote down vote up
private BalloonLayoutConfiguration(@Nonnull Dimension iconOffset,
                                   int topSpaceHeight,
                                   int titleContentSpaceHeight,
                                   int contentActionsSpaceHeight,
                                   int titleActionsSpaceHeight,
                                   int bottomSpaceHeight) {
  this(JBUI.scale(32), iconOffset,
       topSpaceHeight, titleContentSpaceHeight, contentActionsSpaceHeight, titleActionsSpaceHeight, bottomSpaceHeight,
       JBUI.scale(16),
       new JBDimension(8, 6), JBUI.scale(7), JBUI.scale(5), JBUI.scale(15));
}
 
Example #5
Source File: TipPanel.java    From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Dimension getPreferredSize() {
  return new JBDimension(DEFAULT_WIDTH, DEFAULT_HEIGHT);
}
 
Example #6
Source File: TestStatusLine.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setPreferredSize(boolean orientation) {
  final Dimension size = new JBDimension(orientation ? 150 : 450 , -1);
  myProgressPanel.setMaximumSize(size);
  myProgressPanel.setMinimumSize(size);
  myProgressPanel.setPreferredSize(size);
}
 
Example #7
Source File: ActionButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setMinimumButtonSize(@Nonnull Dimension size) {
  myMinimumButtonSize = JBDimension.create(size);
}
 
Example #8
Source File: BalloonLayoutConfiguration.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static BalloonLayoutConfiguration twoLines() {
  return new BalloonLayoutConfiguration(new JBDimension(10, 11),
                                        JBUI.scale(11), JBUI.scale(5), JBUI.scale(5), JBUI.scale(5), JBUI.scale(14));
}
 
Example #9
Source File: BalloonLayoutConfiguration.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static BalloonLayoutConfiguration treeLines() {
  return new BalloonLayoutConfiguration(new JBDimension(10, 7),
                                        JBUI.scale(7), JBUI.scale(3), JBUI.scale(7), 0, JBUI.scale(8));
}
 
Example #10
Source File: TipPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Dimension getPreferredSize() {
  return new JBDimension(DEFAULT_WIDTH, DEFAULT_HEIGHT);
}