@Override protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) { int delta = 0; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex)) { if (this.tabPane.getComponentOrientation().isLeftToRight()) { delta = 5 - SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex); } else { delta = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex) - 5; } } return delta + super.getTabLabelShiftX(tabPlacement, tabIndex, isSelected); }
@Override protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) { int delta = 0; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex)) { if (this.tabPane.getComponentOrientation().isLeftToRight()) { delta = 5 - SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex); } else { delta = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex) - 5; } } return delta + super.getTabLabelShiftX(tabPlacement, tabIndex, isSelected); }
return this.getCloseButtonRectangleForDraw(tabIndex, x, y, w, h); int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex);
return this.getCloseButtonRectangleForDraw(tabIndex, x, y, w, h); int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex);
/** * Retrieves the close button rectangle for drawing purposes. * * @param tabIndex * Tab index. * @param x * X coordinate of the tab. * @param y * Y coordinate of the tab. * @param width * The tab width. * @param height * The tab height. * @return The close button rectangle. */ protected Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height) { int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex); int borderDelta = (int) Math.ceil(3.0 * SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); int xs = this.tabPane.getComponentOrientation().isLeftToRight() ? (x + width - dimension - borderDelta) : (x + borderDelta); int ys = y + (height - dimension) / 2 + 1; return new Rectangle(xs, ys, dimension, dimension); }
/** * Retrieves the close button rectangle for drawing purposes. * * @param tabIndex * Tab index. * @param x * X coordinate of the tab. * @param y * Y coordinate of the tab. * @param width * The tab width. * @param height * The tab height. * @return The close button rectangle. */ protected Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height) { int dimension = SubstanceCoreUtilities.getCloseButtonSize(this.tabPane, tabIndex); int borderDelta = (int) Math.ceil(3.0 * SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); int xs = this.tabPane.getComponentOrientation().isLeftToRight() ? (x + width - dimension - borderDelta) : (x + borderDelta); int ys = y + (height - dimension) / 2 + 1; return new Rectangle(xs, ys, dimension, dimension); }
/** * Returns extra width for the specified tab. * * @param tabPlacement * Tab placement. * @param tabIndex * Tab index. * @return Extra width for the specified tab. */ protected int getTabExtraWidth(int tabPlacement, int tabIndex) { int extraWidth = 0; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(this.tabPane); if (shaper instanceof ClassicButtonShaper) extraWidth = (int) (2.0 * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); else extraWidth = super.calculateTabHeight(tabPlacement, tabIndex, this .getFontMetrics().getHeight()) / 3; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex) && this.tabPane.isEnabledAt(tabIndex)) { extraWidth += (4 + SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex)); } // System.out.println(tabPane.getTitleAt(tabIndex) + ":" + extraWidth); return extraWidth; }
/** * Returns extra width for the specified tab. * * @param tabPlacement * Tab placement. * @param tabIndex * Tab index. * @return Extra width for the specified tab. */ protected int getTabExtraWidth(int tabPlacement, int tabIndex) { int extraWidth = 0; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(this.tabPane); if (shaper instanceof ClassicButtonShaper) extraWidth = (int) (2.0 * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); else extraWidth = super.calculateTabHeight(tabPlacement, tabIndex, this .getFontMetrics().getHeight()) / 3; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex) && this.tabPane.isEnabledAt(tabIndex)) { extraWidth += (4 + SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex)); } // System.out.println(tabPane.getTitleAt(tabIndex) + ":" + extraWidth); return extraWidth; }