本文整理汇总了Java中com.intellij.ui.paint.RectanglePainter类的典型用法代码示例。如果您正苦于以下问题:Java RectanglePainter类的具体用法?Java RectanglePainter怎么用?Java RectanglePainter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RectanglePainter类属于com.intellij.ui.paint包,在下文中一共展示了RectanglePainter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import com.intellij.ui.paint.RectanglePainter; //导入依赖的package包/类
@Override
void paint(Graphics2D g) {
Rectangle r = new Rectangle(getSize());
JBInsets.removeFrom(r, getInsets());
if (r.height % 2 == 1) r.height++;
int arcSize = JBUI.scale(26);
JBInsets.removeFrom(r, new JBInsets(1, 1, 1, 1));
if (myTextArea.hasFocus()) {
g.setColor(myTextArea.getBackground());
RectanglePainter.FILL.paint(g, r.x, r.y, r.width, r.height, arcSize);
DarculaUIUtil.paintSearchFocusRing(g, r, myTextArea, arcSize);
}
else {
arcSize -= JBUI.scale(5);
RectanglePainter
.paint(g, r.x, r.y, r.width, r.height, arcSize, myTextArea.getBackground(), myTextArea.isEnabled() ? Gray._100 : Gray._83);
}
}
示例2: draw
import com.intellij.ui.paint.RectanglePainter; //导入依赖的package包/类
protected void draw(final Graphics2D g, final int x, final int y, final int width, final int height) {
RectanglePainter.DRAW.paint(g, x, y, width, height, null);
}
示例3: fill
import com.intellij.ui.paint.RectanglePainter; //导入依赖的package包/类
@Override
protected void fill(Graphics2D g, int x, int y, int width, int height, boolean border) {
RectanglePainter.FILL.paint(g, x, y, width, height, Math.min(width, height));
}
示例4: draw
import com.intellij.ui.paint.RectanglePainter; //导入依赖的package包/类
@Override
protected void draw(Graphics2D g, int x, int y, int width, int height) {
RectanglePainter.DRAW.paint(g, x, y, width, height, Math.min(width, height));
}
示例5: paint
import com.intellij.ui.paint.RectanglePainter; //导入依赖的package包/类
@Override
public void paint(@Nonnull final Crumb c, @Nonnull final Graphics2D g2, final int height, final int pageOffset) {
final PainterSettings s = getSettings();
final Font oldFont = g2.getFont();
final int offset = c.getOffset() - pageOffset;
final int width = c.getWidth();
RectanglePainter.paint(g2, offset + 2, 2, width - 4, height - 4, ROUND_VALUE + 2, s.getBackgroundColor(c), s.getBorderColor(c));
final Color textColor = s.getForegroundColor(c);
if (textColor != null) {
g2.setColor(textColor);
}
final Font font = s.getFont(g2, c);
if (font != null) {
g2.setFont(font);
}
final FontMetrics fm = g2.getFontMetrics();
String string = c.getString();
if (fm.stringWidth(string) > width) {
final int dotsWidth = fm.stringWidth("...");
final StringBuilder sb = new StringBuilder();
int length = 0;
for (int i = 0; i < string.length(); i++) {
final int charWidth = fm.charWidth(string.charAt(i));
if (length + charWidth + dotsWidth > width) {
break;
}
length += charWidth;
sb.append(string.charAt(i));
}
string = sb.append("...").toString();
}
g2.drawString(string, offset + ROUND_VALUE + 5, height - fm.getDescent() - 5);
g2.setFont(oldFont);
}