Java Code Examples for com.intellij.util.ui.JBUI#scale()

The following examples show how to use com.intellij.util.ui.JBUI#scale() . 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: DesktopColorPicker.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private Pair<Integer, Integer> pointToCellCoords(Point p) {
  int x = p.x;
  int y = p.y;

  final Insets i = getInsets();
  final Dimension d = getSize();

  final int left = i.left + (d.width - i.left - i.right - getComponentWidth()) / 2;
  final int top = i.top + (d.height - i.top - i.bottom - getComponentHeight()) / 2;

  int col = (x - left - JBUI.scale(2)) / 31;
  col = col > JBUI.scale(9) ? JBUI.scale(9) : col;
  int row = (y - top - JBUI.scale(2)) / 31;
  row = row > JBUI.scale(1) ? JBUI.scale(1) : row;

  return row >= 0 && col >= 0 ? Pair.create(row, col) : null;
}
 
Example 2
Source File: WelcomeDesktopBalloonLayoutImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void paintComponent(Graphics g) {
  super.paintComponent(g);

  int count = getComponentCount() - 1;
  if (count > 0) {
    int x2 = getWidth() - JBUI.scale(16);
    int y = 0;

    g.setColor(new JBColor(0xD0D0D0, 0x717375));

    for (int i = 0; i < count; i++) {
      Dimension size = getComponent(i).getPreferredSize();
      y += size.height + 1;
      g.drawLine(JBUI.scale(16), y, x2, y);
    }
  }
}
 
Example 3
Source File: CreatePullRequestForm.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
private void ensureInitialized() {
    if (!this.initialized) {
        // Make sure the busy spinner size is scaled properly
        Dimension spinnerSize = new Dimension(JBUI.scale(20), JBUI.scale(20));
        spinner.setPreferredSize(spinnerSize);
        spinner.setMinimumSize(spinnerSize);

        // Fix tab keys on text area
        SwingHelper.fixTabKeys(descriptionTextArea);

        // Make sure the comment field has a reasonable height, margins, and font
        SwingHelper.setPreferredHeight(descriptionScrollPane, 80);
        SwingHelper.copyFontAndMargins(descriptionTextArea, titleTextField);

        // Give the description field a min size
        Dimension descriptionScrollPaneSize = new Dimension(JBUI.scale(80), JBUI.scale(80));
        descriptionScrollPane.setPreferredSize(descriptionScrollPaneSize);
        descriptionScrollPane.setMinimumSize(descriptionScrollPaneSize);

        // Make sure splitter is big enough in all DPIs
        splitPane.setDividerSize(JBUI.scale(7));

        this.initialized = true;
    }
}
 
Example 4
Source File: MultiIconSimpleColoredComponent.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public MultiIconSimpleColoredComponent() {
  myFragments = new ArrayList<>(3);
  myLayouts = new ArrayList<>(3);
  myAttributes = new ArrayList<>(3);
  myIcons = new ArrayList<>(3);
  myIpad = new JBInsets(1, 2, 1, 2);
  myIconTextGap = JBUI.scale(2);
  myBorder = new MyBorder();
  myFragmentPadding = new TIntIntHashMap(10);
  myFragmentAlignment = new TIntIntHashMap(10);
  setOpaque(true);
  updateUI();
}
 
Example 5
Source File: SingleRowLayout.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void prepareLayoutPassInfo(SingleRowPassInfo data, TabInfo selected) {
  data.insets = myTabs.getLayoutInsets();
  data.insets.left += JBUI.scale(myTabs.getFirstTabOffset());

  final JBTabsImpl.Toolbar selectedToolbar = myTabs.myInfo2Toolbar.get(selected);
  data.hToolbar = selectedToolbar != null && myTabs.myHorizontalSide && !selectedToolbar.isEmpty() ? selectedToolbar : null;
  data.vToolbar = selectedToolbar != null && !myTabs.myHorizontalSide && !selectedToolbar.isEmpty() ? selectedToolbar : null;
  data.toFitLength = getStrategy().getToFitLength(data);

  if (myTabs.isGhostsAlwaysVisible()) {
    data.toFitLength -= myTabs.getGhostTabLength() * 2 + (myTabs.getInterTabSpaceLength() * 2);
  }
}
 
Example 6
Source File: LockItemsTableModel.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
Column(final String name, final int width) {
    this.name = name;
    this.width = JBUI.scale(width);
}
 
Example 7
Source File: LabelItemsTableModel.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
Column(final String name, final int width) {
    this.name = name;
    this.width = JBUI.scale(width);
}
 
Example 8
Source File: AbstractColorsScheme.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public int getConsoleFontSize(boolean scale) {
  int consoleFontSizeInternal = getConsoleFontSizeInternal();
  return scale ? JBUI.scale(consoleFontSizeInternal) : consoleFontSizeInternal;
}
 
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: DesktopEditorErrorPanelUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
private int getBorderWidth() {
  return JBUI.scale(1);
}
 
Example 11
Source File: VerticalFlowLayout.java    From consulo with Apache License 2.0 4 votes vote down vote up
public VerticalFlowLayout(@VerticalFlowAlignment int alignment) {
  this(alignment, JBUI.scale(5), JBUI.scale(5), true, false);
}
 
Example 12
Source File: DesktopColorPicker.java    From consulo with Apache License 2.0 4 votes vote down vote up
public int getComponentWidth() {
  return JBUI.scale(10 * 30 + 13);
}
 
Example 13
Source File: DarculaMenuBarBorder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Insets getBorderInsets(Component c) {
  return new InsetsUIResource(0, 0, JBUI.scale(2), 0);
}
 
Example 14
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 15
Source File: BalloonLayoutConfiguration.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String MaxWidthStyle() {
  return "width:" + JBUI.scale(RawStyleWidth) + "px;";
}
 
Example 16
Source File: SlideComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static int getPointerOffset() {
  return JBUI.scale(11);
}
 
Example 17
Source File: VcsHistoryUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static Font getCommitDetailsFont() {
  return JBUI.scale(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
}
 
Example 18
Source File: ModernButtonlessScrollBarUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected int getThickness() {
  return JBUI.scale(10);
}
 
Example 19
Source File: SlideComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private int pointerValueToValue(int pointerValue) {
  pointerValue -= getPointerOffset();
  final int size = myVertical ? getHeight() : getWidth();
  float proportion = (size - JBUI.scale(23)) / 255f;
  return (int)(pointerValue / proportion);
}
 
Example 20
Source File: InspectorTreeUI.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected int getCustomIndent() {
  return JBUI.scale(Registry.intValue("ide.ui.tree.indent"));
}