Java Code Examples for com.intellij.util.ui.UIUtil#drawDottedRectangle()
The following examples show how to use
com.intellij.util.ui.UIUtil#drawDottedRectangle() .
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: FocusTracesDialog.java From consulo with Apache License 2.0 | 6 votes |
private void paintBorder() { final int row = FocusTracesDialog.this.myRequestsTable.getSelectedRow(); if (row != -1) { final FocusRequestInfo info = FocusTracesDialog.this.myRequests.get(row); if (prev != null && prev != info.getComponent()) { prev.repaint(); } prev = info.getComponent(); if (prev != null && prev.isDisplayable()) { final Graphics g = prev.getGraphics(); g.setColor(JBColor.RED); final Dimension sz = prev.getSize(); UIUtil.drawDottedRectangle(g, 1, 1, sz.width - 2, sz.height - 2); } } }
Example 2
Source File: FocusDebuggerAction.java From consulo with Apache License 2.0 | 5 votes |
private void paintFocusBorders(boolean clean) { if (myCurrent != null) { Graphics currentFocusGraphics = myCurrent.getGraphics(); if (currentFocusGraphics != null) { if (clean) { if (myCurrent.isDisplayable()) { myCurrent.repaint(); } } else { currentFocusGraphics.setColor(myTemporary ? JBColor.ORANGE : JBColor.GREEN); UIUtil.drawDottedRectangle(currentFocusGraphics, 1, 1, myCurrent.getSize().width - 2, myCurrent.getSize().height - 2); } } } if (myPrevious != null) { Graphics previousFocusGraphics = myPrevious.getGraphics(); if (previousFocusGraphics != null) { if (clean) { if (myPrevious.isDisplayable()) { myPrevious.repaint(); } } else { previousFocusGraphics.setColor(JBColor.RED); UIUtil.drawDottedRectangle(previousFocusGraphics, 1, 1, myPrevious.getSize().width - 2, myPrevious.getSize().height - 2); } } } }
Example 3
Source File: DottedBorder.java From consulo with Apache License 2.0 | 4 votes |
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(myColor); UIUtil.drawDottedRectangle(g, x, y, x + width - 1, y + height - 1); }
Example 4
Source File: SimpleColoredComponent.java From consulo with Apache License 2.0 | 4 votes |
@Override public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { g.setColor(Color.BLACK); UIUtil.drawDottedRectangle(g, x, y, x + width - 1, y + height - 1); }
Example 5
Source File: MultilineTreeCellRenderer.java From consulo with Apache License 2.0 | 4 votes |
public void paint(Graphics g) { int height = getHeight(); int width = getWidth(); int borderX = myLabelInsets.left - 1; int borderY = myLabelInsets.top - 1; int borderW = width - borderX - myLabelInsets.right + 2; int borderH = height - borderY - myLabelInsets.bottom + 1; if (myIcon != null) { int verticalIconPosition = (height - myIcon.getIconHeight())/2; myIcon.paintIcon(this, g, 0, verticalIconPosition); borderX += myIcon.getIconWidth(); borderW -= myIcon.getIconWidth(); } Color bgColor; Color fgColor; if (mySelected && myHasFocus){ bgColor = UIUtil.getTreeSelectionBackground(); fgColor = UIUtil.getTreeSelectionForeground(); } else{ bgColor = UIUtil.getTreeTextBackground(); fgColor = getForeground(); } // fill background if (!(myTree.getUI() instanceof WideSelectionTreeUI) || !((WideSelectionTreeUI)myTree.getUI()).isWideSelection()) { g.setColor(bgColor); g.fillRect(borderX, borderY, borderW, borderH); // draw border if (mySelected) { g.setColor(UIUtil.getTreeSelectionBorderColor()); UIUtil.drawDottedRectangle(g, borderX, borderY, borderX + borderW - 1, borderY + borderH - 1); } } // paint text recalculateWraps(); if (myTooSmall) { // TODO ??? return; } int fontHeight = getCurrFontMetrics().getHeight(); int currBaseLine = getCurrFontMetrics().getAscent(); currBaseLine += myTextInsets.top; g.setFont(getFont()); g.setColor(fgColor); UISettings.setupAntialiasing(g); if (!StringUtil.isEmpty(myPrefix)) { g.drawString(myPrefix, myTextInsets.left - myPrefixWidth + 1, currBaseLine); } for (int i = 0; i < myWraps.size(); i++) { String currLine = (String)myWraps.get(i); g.drawString(currLine, myTextInsets.left, currBaseLine); currBaseLine += fontHeight; // first is getCurrFontMetrics().getAscent() } }
Example 6
Source File: UiInspectorAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void paintComponent(final Graphics g) { Graphics2D g2d = (Graphics2D)g; GraphicsConfig config = new GraphicsConfig(g).setAntialiasing(UISettings.getShadowInstance().getIdeAAType() != AntialiasingType.OFF); Rectangle bounds = getBounds(); g2d.setColor(getBackground()); Insets insets = getInsets(); g2d.fillRect(insets.left, insets.top, bounds.width - insets.left - insets.right, bounds.height - insets.top - insets.bottom); final String sizeString = String.format("%d x %d", myWidth, myHeight); FontMetrics fm = g2d.getFontMetrics(); int sizeWidth = fm.stringWidth(sizeString); int fontHeight = fm.getHeight(); int innerBoxWidthGap = JBUI.scale(20); int innerBoxHeightGap = JBUI.scale(5); int boxSize = JBUI.scale(15); int centerX = bounds.width / 2; int centerY = bounds.height / 2; int innerX = centerX - sizeWidth / 2 - innerBoxWidthGap; int innerY = centerY - fontHeight / 2 - innerBoxHeightGap; int innerWidth = sizeWidth + innerBoxWidthGap * 2; int innerHeight = fontHeight + innerBoxHeightGap * 2; g2d.setColor(getForeground()); drawCenteredString(g2d, fm, fontHeight, sizeString, centerX, centerY); g2d.setColor(JBColor.GRAY); g2d.drawRect(innerX, innerY, innerWidth, innerHeight); Insets borderInsets = null; if (myBorder != null) borderInsets = myBorder.getBorderInsets(myComponent); UIUtil.drawDottedRectangle(g2d, innerX - boxSize, innerY - boxSize, innerX + innerWidth + boxSize, innerY + innerHeight + boxSize); drawInsets(g2d, fm, "border", borderInsets, boxSize, fontHeight, innerX, innerY, innerWidth, innerHeight); g2d.drawRect(innerX - boxSize * 2, innerY - boxSize * 2, innerWidth + boxSize * 4, innerHeight + boxSize * 4); drawInsets(g2d, fm, "insets", myInsets, boxSize * 2, fontHeight, innerX, innerY, innerWidth, innerHeight); config.restore(); }
Example 7
Source File: BegButtonUI.java From consulo with Apache License 2.0 | 4 votes |
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { UIUtil.drawDottedRectangle(g, viewRect.x, viewRect.y, viewRect.x + viewRect.width, viewRect.y + viewRect.height); }
Example 8
Source File: BegToggleButtonUI.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { g.setColor(getFocusColor()); UIUtil.drawDottedRectangle(g, viewRect.x, viewRect.y, viewRect.x + viewRect.width, viewRect.y + viewRect.height); }
Example 9
Source File: BegRadioButtonUI.java From consulo with Apache License 2.0 | 4 votes |
protected void paintFocus(Graphics g, Rectangle t, Dimension d) { g.setColor(getFocusColor()); UIUtil.drawDottedRectangle(g, t.x - 2, t.y - 1, t.x + t.width + 1, t.y + t.height); }
Example 10
Source File: BegCheckBoxUI.java From consulo with Apache License 2.0 | 4 votes |
protected void paintFocus(Graphics g, Rectangle t, Dimension d) { g.setColor(getFocusColor()); UIUtil.drawDottedRectangle(g, t.x - 2, t.y - 1, t.x + t.width + 1, t.y + t.height); }