public final void fillSelectionAndBorder(final Graphics2D g, final ShapeTransform selectedShape, final Color tabColor, final int x, final int y, final int height) { g.setColor(tabColor != null ? tabColor : getDefaultTabColor()); g.fill(selectedShape.getShape()); }
public ShapeTransform createShapeTransform(Rectangle labelRec) { return new ShapeTransform.Top(labelRec); }
@Override public ShapeTransform createShapeTransform(Rectangle labelRec) { return new ShapeTransform.Bottom(labelRec); }
@Override public ShapeTransform createShapeTransform(Rectangle labelRec) { return new ShapeTransform.Left(labelRec); }
public ShapeTransform createShapeTransform(Rectangle labelRec) { return new ShapeTransform.Right(labelRec); }
/** * Paint tab selected and highlight border * * @param objects * @param borderColor * @param borderThickness * @param tabsPainter */ private void paintSelectionAndBorder(final Object[] objects, final Color borderColor, final int borderThickness, final MTTabsPainter tabsPainter) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { // Get the shapeinfo class because it is protected final Class<?> clazz = Class.forName("com.intellij.ui.tabs.impl.JBTabsImpl$ShapeInfo"); // Retrieve arguments final Graphics2D g2d = (Graphics2D) objects[0]; final Rectangle rect = (Rectangle) objects[1]; final Object selectedShape = objects[2]; final Color tabColor = (Color) objects[4]; // Retrieve private fields of ShapeInfo class final Field fillPathField = clazz.getField("fillPath"); final ShapeTransform fillPath = (ShapeTransform) fillPathField.get(selectedShape); // Other properties needed for drawing final int rectX = rect.x; final int rectY = rect.y; final int rectHeight = rect.height; // The tabs component final JBEditorTabs tabsComponent = tabsPainter.getTabsComponent(); // Position of tabs final JBTabsPosition position = tabsComponent.getTabsPosition(); // color me tabsPainter.fillSelectionAndBorder(g2d, fillPath, tabColor, rectX, rectY, rectHeight); g2d.setColor(borderColor); if (position == JBTabsPosition.bottom) { // Paint on top g2d.fillRect(rect.x, rect.y - 1, rect.width, borderThickness); } else if (position == JBTabsPosition.top) { // Paint on bottom g2d.fillRect(rect.x, rect.y + rect.height - borderThickness + 1, rect.width, borderThickness); g2d.setColor(UIUtil.CONTRAST_BORDER_COLOR); g2d.drawLine(Math.max(0, rect.x - 1), rect.y, rect.x + rect.width, rect.y); } else if (position == JBTabsPosition.left) { g2d.fillRect(rect.x, rect.y, borderThickness, rect.height); } else if (position == JBTabsPosition.right) { g2d.fillRect(rect.x + rect.width - borderThickness + 1, rect.y, borderThickness, rect.height); } }
public abstract ShapeTransform createShapeTransform(Rectangle rectangle);