@Override protected ShapeInfo _computeSelectedLabelShape() { ShapeInfo shape = new ShapeInfo(); shape.path = getEffectiveLayout().createShapeTransform(getSize()); shape.insets = shape.path.transformInsets(getLayoutInsets()); shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds()); shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1); boolean isTop = getPosition() == JBTabsPosition.top; boolean isBottom = getPosition() == JBTabsPosition.bottom; shape.labelTopY = shape.labelPath.getY() + (isTop ? shape.labelPath.deltaY(1) : (isBottom ? shape.labelPath.deltaY(-1) : 0)); shape.labelLeftX = shape.labelPath.getX() + (!isTop && !isBottom ? shape.labelPath.deltaX(1) : 0); shape.labelRightX = shape.labelPath.getMaxX(); shape.path.moveTo(shape.labelLeftX, shape.labelBottomY); shape.path.lineTo(shape.labelRightX, shape.labelBottomY); shape.path.lineTo(shape.labelRightX, shape.labelBottomY + shape.labelPath.deltaY(this.getActiveTabUnderlineHeight() - 1)); shape.path.lineTo(shape.labelLeftX, shape.labelBottomY + shape.labelPath.deltaY(this.getActiveTabUnderlineHeight() - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); return shape; }
@Override protected void processDragFinish(MouseEvent event, boolean willDragOutStart) { super.processDragFinish(event, willDragOutStart); endDrag(willDragOutStart); final JBTabsPosition position = myTabs.getTabsPosition(); if (!willDragOutStart && myTabs.isAlphabeticalMode() && position != JBTabsPosition.top && position != JBTabsPosition.bottom) { Point p = new Point(event.getPoint()); p = SwingUtilities.convertPoint(event.getComponent(), p, myTabs); if (myTabs.getVisibleRect().contains(p) && myPressedOnScreenPoint.distance(new RelativePoint(event).getScreenPoint()) > 15) { final int answer = Messages.showOkCancelDialog(myTabs, IdeBundle.message("alphabetical.mode.is.on.warning"), IdeBundle.message("title.warning"), Messages.getQuestionIcon()); if (answer == Messages.OK) { JBEditorTabs.setAlphabeticalMode(false); myTabs.relayout(true, false); myTabs.revalidate(); } } } }
public Insets getEffectiveBorder() { if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone(); myPosition = myTabs.getTabsPosition(); if (myTabs.isEditorTabs()) { // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :( myEffectiveBorder = new Insets(myPosition == JBTabsPosition.top ? TabsUtil.TABS_BORDER : 0, 0, 0, 0); } else { myEffectiveBorder = new Insets( myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top, myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left, myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom, myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right ); } return (Insets)myEffectiveBorder.clone(); }
@Override public Dimension getPreferredSize() { final Dimension size = super.getPreferredSize(); size.height = TabsUtil.getTabsHeight(); if (myActionPanel != null && !myActionPanel.isVisible()) { final Dimension actionPanelSize = myActionPanel.getPreferredSize(); size.width += actionPanelSize.width; } final JBTabsPosition pos = myTabs.getTabsPosition(); switch (pos) { case top: case bottom: if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1; break; case left: case right: size.width += getSelectedOffset(); break; } return size; }
public Insets getEffectiveBorder() { if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone(); myPosition = myTabs.getTabsPosition(); if (myTabs.isEditorTabs()) { // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :( myEffectiveBorder = new Insets(TabsUtil.TABS_BORDER, /*myPosition == JBTabsPosition.right ? TabsUtil.TABS_BORDER : */0, 0, 0); } else { myEffectiveBorder = new Insets( myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top, myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left, myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom, myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right ); } return (Insets)myEffectiveBorder.clone(); }
@Override public Dimension getPreferredSize() { final Dimension size = super.getPreferredSize(); size.height = TabsUtil.getTabsHeight(); if (myActionPanel != null && !myActionPanel.isVisible()) { final Dimension actionPanelSize = myActionPanel.getPreferredSize(); size.width += actionPanelSize.width; } final JBTabsPosition pos = myTabs.getTabsPosition(); switch (pos) { case top: case bottom: if (myTabs.hasUnderline()) size.height += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1; break; case left: case right: size.width += getSelectedOffset(); break; } return size; }
@Override public Dimension getPreferredSize() { final Dimension size = super.getPreferredSize(); size.height = TabsUtil.getTabsHeight(); final JBTabsPosition pos = myTabs.getTabsPosition(); switch (pos) { case top: case bottom: if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1; break; case left: case right: size.width += getSelectedOffset(); break; } return size; }
public Insets getEffectiveBorder() { if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone(); myPosition = myTabs.getTabsPosition(); if (myTabs.isEditorTabs()) { // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :( myEffectiveBorder = JBUI.insets(myPosition == JBTabsPosition.top ? TabsUtil.TABS_BORDER : 0, 0, 0, 0); } else { myEffectiveBorder = JBUI.insets( myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top, myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left, myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom, myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right ); } return (Insets)myEffectiveBorder.clone(); }
protected void addHeaderSize(JBTabsImpl tabs, Dimension size, final int tabsCount) { Dimension header = computeHeaderPreferredSize(tabs, tabsCount); final boolean horizontal = tabs.getTabsPosition() == JBTabsPosition.top || tabs.getTabsPosition() == JBTabsPosition.bottom; if (horizontal) { size.height += header.height; size.width = Math.max(size.width, header.width); } else { size.height += Math.max(size.height, header.height); size.width += header.width; } final Insets insets = tabs.getLayoutInsets(); size.width += insets.left + insets.right + 1; size.height += insets.top + insets.bottom + 1; }
protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, TabLabel label, Rectangle effectiveBounds, boolean rightGhostExists, int row, int column) { Insets insets = getTabsBorder().getEffectiveBorder(); int _x = effectiveBounds.x + insets.left; int _y = effectiveBounds.y + insets.top; int _width = effectiveBounds.width - insets.left - insets.right + (getTabsPosition() == JBTabsPosition.right ? 1 : 0); int _height = effectiveBounds.height - insets.top - insets.bottom; if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs())) { if (isSingleRow() && getPosition() == JBTabsPosition.bottom) { _y += getActiveTabUnderlineHeight(); } else { if (isSingleRow()) { _height -= getActiveTabUnderlineHeight(); } else { TabInfo info = label.getInfo(); if (((TableLayout)getEffectiveLayout()).isLastRow(info)) { _height -= getActiveTabUnderlineHeight(); } } } } final boolean vertical = getTabsPosition() == JBTabsPosition.left || getTabsPosition() == JBTabsPosition.right; final Color tabColor = label.getInfo().getTabColor(); final Composite oldComposite = g2d.getComposite(); //if (label != getSelectedLabel()) { // g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f)); //} getPainter().doPaintInactive(g2d, effectiveBounds, _x, _y, _width, _height, tabColor, row, column, vertical); //g2d.setComposite(oldComposite); }
protected ShapeInfo _computeSelectedLabelShape() { final ShapeInfo shape = new ShapeInfo(); shape.path = getEffectiveLayout().createShapeTransform(getSize()); shape.insets = shape.path.transformInsets(getLayoutInsets()); shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds()); shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1); boolean isTop = getPosition() == JBTabsPosition.top; boolean isBottom = getPosition() == JBTabsPosition.bottom; shape.labelTopY = shape.labelPath.getY() + (isTop ? shape.labelPath.deltaY(1) : isBottom ? shape.labelPath.deltaY(-1) : 0) ; shape.labelLeftX = shape.labelPath.getX() + (isTop || isBottom ? 0 : shape.labelPath.deltaX(1)); shape.labelRightX = shape.labelPath.getMaxX() /*- shape.labelPath.deltaX(1)*/; int leftX = shape.insets.left + (isTop || isBottom ? 0 : shape.labelPath.deltaX(1)); shape.path.moveTo(leftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelBottomY); int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right); shape.path.lineTo(lastX, shape.labelBottomY); shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); return shape; }
@Override public void setProportion(float proportion) { int width = myTabs.getWidth(); if (myTabs.getTabsPosition() == JBTabsPosition.left) { setSideTabsLimit((int)Math.max(JBTabsImpl.MIN_TAB_WIDTH, proportion * width)); } else if (myTabs.getTabsPosition() == JBTabsPosition.right) { setSideTabsLimit(width - (int)Math.max(JBTabsImpl.MIN_TAB_WIDTH, proportion * width)); } }
protected void calculateRequiredLength(SingleRowPassInfo data) { for (TabInfo eachInfo : data.myVisibleInfos) { data.requiredLength += getRequiredLength(eachInfo); if (myTabs.getTabsPosition() == JBTabsPosition.left || myTabs.getTabsPosition() == JBTabsPosition.right) { data.requiredLength -= 1; } data.toLayout.add(eachInfo); } }
public void doTranslate(PairConsumer<Integer, Integer> consumer) { final JBTabsPosition pos = myTabs.getTabsPosition(); int dX = 0; int dXs = 0; int dY = 0; int dYs = 0; int selected = getSelectedOffset(); int plain = getNonSelectedOffset(); switch (pos) { case bottom: dY = -plain; dYs = -selected; break; case left: dX = plain; dXs = selected; break; case right: dX = -plain; dXs = -selected; break; case top: dY = plain; dYs = selected; break; } if (!myTabs.isDropTarget(myInfo)) { if (myTabs.getSelectedInfo() != myInfo) { consumer.consume(dX, dY); } else { consumer.consume(dXs, dYs); } } }
protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, TabLabel label, Rectangle effectiveBounds, boolean rightGhostExists, int row, int column) { Insets insets = getTabsBorder().getEffectiveBorder(); int _x = effectiveBounds.x + insets.left; int _y = effectiveBounds.y + insets.top; int _width = effectiveBounds.width - insets.left - insets.right + (getTabsPosition() == JBTabsPosition.right ? 1 : 0); int _height = effectiveBounds.height - insets.top - insets.bottom; if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs())) { if (isSingleRow() && getPosition() == JBTabsPosition.bottom) { _y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; } else { if (isSingleRow()) { _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; } else { TabInfo info = label.getInfo(); if (((TableLayout)getEffectiveLayout()).isLastRow(info)) { _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; } } } } final boolean vertical = getTabsPosition() == JBTabsPosition.left || getTabsPosition() == JBTabsPosition.right; final Color tabColor = label.getInfo().getTabColor(); getPainter().doPaintInactive(g2d, effectiveBounds, _x, _y, _width, _height, tabColor, row, column, vertical); }
protected ShapeInfo _computeSelectedLabelShape() { final ShapeInfo shape = new ShapeInfo(); shape.path = getEffectiveLayout().createShapeTransform(getSize()); shape.insets = shape.path.transformInsets(getLayoutInsets()); shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds()); shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1); shape.labelTopY = shape.labelPath.getY() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0) ; shape.labelLeftX = shape.labelPath.getX() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX( 1)); shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1); int leftX = shape.insets.left + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1)); shape.path.moveTo(leftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelBottomY); int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right); shape.path.lineTo(lastX, shape.labelBottomY); shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); return shape; }
protected Dimension computeHeaderPreferredSize(JBTabsImpl tabs, int tabsCount) { final Iterator<TabInfo> infos = tabs.myInfo2Label.keySet().iterator(); Dimension size = new Dimension(); int currentTab = 0; final boolean horizontal = tabs.getTabsPosition() == JBTabsPosition.top || tabs.getTabsPosition() == JBTabsPosition.bottom; while (infos.hasNext()) { final boolean canGrow = currentTab < tabsCount; TabInfo eachInfo = infos.next(); final TabLabel eachLabel = tabs.myInfo2Label.get(eachInfo); final Dimension eachPrefSize = eachLabel.getPreferredSize(); if (horizontal) { if (canGrow) { size.width += eachPrefSize.width; } size.height = Math.max(size.height, eachPrefSize.height); } else { size.width = Math.max(size.width, eachPrefSize.width); if (canGrow) { size.height += eachPrefSize.height; } } currentTab++; } if (horizontal) { size.height += tabs.getTabsBorder().getTabBorderSize(); } else { size.width += tabs.getTabsBorder().getTabBorderSize(); } return size; }
protected void doPaintInactive(JBTabsImpl t, Graphics2D g2d, boolean leftGhostExists, TabLabel label, Rectangle effectiveBounds, boolean rightGhostExists, int row, int column) { Insets insets = t.getTabsBorder().getEffectiveBorder(); int _x = effectiveBounds.x + insets.left; int _y = effectiveBounds.y + insets.top; int _width = effectiveBounds.width - insets.left - insets.right + (t.getTabsPosition() == JBTabsPosition.right ? 1 : 0); int _height = effectiveBounds.height - insets.top - insets.bottom; if ((!t.isSingleRow() /* for multiline */) || (t.isSingleRow() && t.isHorizontalTabs())) { if (t.isSingleRow() && t.getPosition() == JBTabsPosition.bottom) { _y += t.getActiveTabUnderlineHeight(); } else { if (t.isSingleRow()) { _height -= t.getActiveTabUnderlineHeight(); } else { TabInfo info = label.getInfo(); if (((TableLayout)t.getEffectiveLayout()).isLastRow(info)) { _height -= t.getActiveTabUnderlineHeight(); } } } } final boolean vertical = t.getTabsPosition() == JBTabsPosition.left || t.getTabsPosition() == JBTabsPosition.right; final Color tabColor = label.getInfo().getTabColor(); doPaintInactive(g2d, effectiveBounds, _x, _y, _width, _height, tabColor, row, column, vertical); }
protected void doPaintAdditionalBackgroundIfFirstOffsetSet(JBTabsImpl tabs, Graphics2D g2d, Rectangle clip) { if (tabs.getTabsPosition() == JBTabsPosition.top && tabs.isSingleRow() && tabs.getFirstTabOffset() > 0) { int maxOffset = 0; int maxLength = 0; for (int i = tabs.getVisibleInfos().size() - 1; i >= 0; i--) { TabInfo visibleInfo = tabs.getVisibleInfos().get(i); TabLabel tabLabel = tabs.myInfo2Label.get(visibleInfo); Rectangle r = tabLabel.getBounds(); if (r.width == 0 || r.height == 0) continue; maxOffset = r.x + r.width; maxLength = r.height; break; } maxOffset++; g2d.setPaint(UIUtil.getPanelBackground()); if (tabs.getFirstTabOffset() > 0) { g2d.fillRect(clip.x, clip.y, clip.x + JBUI.scale(tabs.getFirstTabOffset() - 1), clip.y + maxLength - tabs.getActiveTabUnderlineHeight()); } g2d.fillRect(clip.x + maxOffset, clip.y, clip.width - maxOffset, clip.y + maxLength - tabs.getActiveTabUnderlineHeight()); g2d.setPaint(new JBColor(Gray._181, UIUtil.getPanelBackground())); g2d.drawLine(clip.x + maxOffset, clip.y + maxLength - tabs.getActiveTabUnderlineHeight(), clip.x + clip.width, clip.y + maxLength - tabs.getActiveTabUnderlineHeight()); g2d.setPaint(UIUtil.getPanelBackground()); g2d.drawLine(clip.x, clip.y + maxLength, clip.width, clip.y + maxLength); } }
protected ShapeInfo _computeSelectedLabelShape(JBTabsImpl tabs) { final ShapeInfo shape = new ShapeInfo(); shape.path = tabs.getEffectiveLayout().createShapeTransform(tabs.getSize()); shape.insets = shape.path.transformInsets(tabs.getLayoutInsets()); shape.labelPath = shape.path.createTransform(tabs.getSelectedLabel().getBounds()); shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(tabs.getActiveTabUnderlineHeight() - 1); shape.labelTopY = shape.labelPath.getY() + (tabs.getPosition() == JBTabsPosition.top || tabs.getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0); shape.labelLeftX = shape.labelPath.getX() + (tabs.getPosition() == JBTabsPosition.top || tabs.getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1)); shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1); int leftX = shape.insets.left + (tabs.getPosition() == JBTabsPosition.top || tabs.getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1)); shape.path.moveTo(leftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelBottomY); shape.path.lineTo(shape.labelLeftX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelTopY); shape.path.lineTo(shape.labelRightX, shape.labelBottomY); int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right); shape.path.lineTo(lastX, shape.labelBottomY); shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(tabs.getActiveTabUnderlineHeight() - 1)); shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(tabs.getActiveTabUnderlineHeight() - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); return shape; }
public Rectangle getLayoutRec(final int position, final int fixedPos, final int length, final int fixedFitLength) { return new Rectangle(position, fixedPos + (myTabs.getTabsPosition() == JBTabsPosition.bottom ? 1 : 0), length, fixedFitLength); }
/** * 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); } }
private SimpleColoredComponent createLabel(final JBTabsImpl tabs) { SimpleColoredComponent label = new SimpleColoredComponent() { @Override protected boolean shouldDrawMacShadow() { return SystemInfo.isMac || UIUtil.isUnderDarcula(); } @Override protected boolean shouldDrawDimmed() { return myTabs.getSelectedInfo() != myInfo || myTabs.useBoldLabels(); } @Override public Font getFont() { if (isFontSet() || !myTabs.useSmallLabels()) { return super.getFont(); } return UIUtil.getLabelFont(UIUtil.FontSize.SMALL); } @Override protected void doPaint(Graphics2D g) { if (UISettings.getInstance().HIDE_TABS_IF_NEED || tabs.getTabsPosition() == JBTabsPosition.left || tabs.getTabsPosition() == JBTabsPosition.right) { super.doPaint(g); return; } Rectangle clip = getVisibleRect(); if (getPreferredSize().width <= clip.width) { super.doPaint(g); return; } int dimSize = 30; int dimStep = 2; Composite oldComposite = g.getComposite(); Shape oldClip = g.getClip(); try { g.setClip(clip.x, clip.y, Math.max(0, clip.width - dimSize), clip.height); super.doPaint(g); for (int x = clip.x + clip.width - dimSize; x < clip.x + clip.width; x += dimStep) { g.setClip(x, clip.y, dimStep, clip.height); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1 - ((float)x - (clip.x + clip.width - dimSize)) / dimSize)); super.doPaint(g); } } finally { g.setComposite(oldComposite); g.setClip(oldClip); } } }; label.setOpaque(false); label.setBorder(null); label.setIconTextGap(tabs.isEditorTabs() ? (!UISettings.getInstance().HIDE_TABS_IF_NEED ? JBUI.scale(4) : JBUI.scale(2)) : new JLabel().getIconTextGap()); label.setIconOpaque(false); label.setIpad(JBUI.emptyInsets()); return label; }