4632N/A return new AquaTabbedPaneUI();
4632N/A protected final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getTab());
4632N/A super.installListeners();
4632N/A super.installDefaults();
4632N/A return new MouseHandler();
4632N/A return new FocusHandler();
4632N/A return new TabbedPanePropertyChangeHandler();
4632N/A return new AquaTruncatingTabbedPaneLayout();
4632N/A final boolean isLeftToRight = tabPane.getComponentOrientation().isLeftToRight() || tabPlacement == LEFT || tabPlacement == RIGHT;
4632N/A paintScrollingTabs(g, clipRect, tabPlacement, selectedIndex, active, frameActive, isLeftToRight);
4632N/A protected void paintAllTabs(final Graphics g, final Rectangle clipRect, final int tabPlacement, final int selectedIndex, final boolean active, final boolean frameActive, final boolean isLeftToRight) {
4632N/A boolean drawSelectedLast = false;
4632N/A if (i == selectedIndex) {
4632N/A drawSelectedLast = true;
4632N/A protected void paintScrollingTabs(final Graphics g, final Rectangle clipRect, final int tabPlacement, final int selectedIndex, final boolean active, final boolean frameActive, final boolean isLeftToRight) {
4632N/A paintTabNormalFromRect(g, tabPlacement, leftScrollTabRect, -2, fIconRect, fTextRect, visibleTabState.needsLeftScrollTab(), frameActive, isLeftToRight);
4632N/A paintTabNormalFromRect(g, tabPlacement, rightScrollTabRect, -1, fIconRect, fTextRect, visibleTabState.needsRightScrollTab(), frameActive, isLeftToRight);
4632N/A protected int getTabLabelShiftX(final int tabPlacement, final int tabIndex, final boolean isSelected) {
4632N/A final Rectangle tabRect = (tabIndex >= 0 ? rects[tabIndex] : visibleTabState.getRightScrollTabRect());
4632N/A switch (tabPlacement) {
4632N/A protected int getTabLabelShiftY(final int tabPlacement, final int tabIndex, final boolean isSelected) {
4632N/A switch (tabPlacement) {
4632N/A protected Icon getIconForScrollTab(final int tabPlacement, final int tabIndex, final boolean enabled) {
4632N/A if (shouldFlip) {
4632N/A protected void paintContents(final Graphics g, final int tabPlacement, final int tabIndex, final Rectangle tabRect, final Rectangle iconRect, final Rectangle textRect, final boolean isSelected) {
4632N/A if (isVertical) {
4632N/A layoutLabel(tabPlacement, metrics, tabIndex < 0 ? 0 : tabIndex, title, icon, fContentRect, iconRect, textRect, false); // Never give it "isSelected" - ApprMgr handles this
4632N/A if (isVertical) {
4639N/A if (!(g instanceof Graphics2D)) {
4632N/A if (isVertical) {
4632N/A protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
4632N/A // sja fix getTheme().setThemeTextColor(g, isSelected, isPressed && tracking, tabPane.isEnabledAt(tabIndex));
4632N/A SwingUtilities2.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
4632N/A protected void rotateGraphics(final Graphics2D g2d, final Rectangle tabRect, final Rectangle textRect, final Rectangle iconRect, final int tabPlacement) {
4632N/A // g.drawLine(textRect.x, textRect.y, textRect.x+textRect.height, textRect.y+textRect.width);
4632N/A // g.drawLine(textRect.x+textRect.height, textRect.y, textRect.x, textRect.y+textRect.width);
4632N/A protected void paintTabNormal(final Graphics g, final int tabPlacement, final int tabIndex, final boolean active, final boolean frameActive, final boolean isLeftToRight) {
4632N/A paintTabNormalFromRect(g, tabPlacement, rects[tabIndex], tabIndex, fIconRect, fTextRect, active, frameActive, isLeftToRight);
4632N/A protected void paintTabNormalFromRect(final Graphics g, final int tabPlacement, final Rectangle tabRect, final int nonRectIndex, final Rectangle iconRect, final Rectangle textRect, final boolean active, final boolean frameActive, final boolean isLeftToRight) {
4632N/A paintCUITab(g, tabPlacement, tabRect, isSelected, frameActive, isLeftToRight, nonRectIndex);
4632N/A protected void paintCUITab(final Graphics g, final int tabPlacement, final Rectangle tabRect, final boolean isSelected, final boolean frameActive, final boolean isLeftToRight, final int nonRectIndex) {
4632N/A painter.state.set(isSelected || (state == State.INACTIVE && frameActive) ? BooleanValue.YES : BooleanValue.NO);
4632N/A protected static SegmentPosition getSegmentPosition(final boolean first, final boolean last, final boolean isLeftToRight) {
4632N/A protected SegmentTrailingSeparator getSegmentTrailingSeparator(final int index, final int selectedIndex, final boolean isLeftToRight) {
4632N/A protected SegmentLeadingSeparator getSegmentLeadingSeparator(final int index, final int selectedIndex, final boolean isLeftToRight) {
4632N/A protected boolean isTabBeforeSelectedTab(final int index, final int selectedIndex, final boolean isLeftToRight) {
4632N/A protected State getState(final int index, final boolean frameActive, final boolean isSelected) {
4632N/A AlterRects(final int x, final int y, final int w, final int h) { standard = new Rectangle(x, y, w, h); }
4632N/A AlterRects start(final int x, final int y, final int w, final int h) { first = new Rectangle(x, y, w, h); return this; }
4632N/A AlterRects end(final int x, final int y, final int w, final int h) { last = new Rectangle(x, y, w, h); return this; }
4632N/A switch (tabPlacement) {
4632N/A case LEFT: return alterRects[LEFT] = new AlterRects(2, 0, -4, 1).start(0, 0, 0, -4).end(0, 3, 0, -3);
4632N/A case RIGHT: return alterRects[RIGHT] = new AlterRects(1, 0, -4, 1).start(0, 0, 0, -4).end(0, 3, 0, -3);
4632N/A case BOTTOM: return alterRects[BOTTOM] = new AlterRects(0, 1, 0, -4).start(3, 0, -3, 0).end(0, 0, -3, 0);
4632N/A default: return alterRects[TOP] = new AlterRects(0, 2, 0, -4).start(3, 0, -3, 0).end(0, 0, -3, 0);
4632N/A protected void fillTabWithBackground(final Graphics g, final Rectangle rect, final int tabPlacement, final boolean first, final boolean last, final Color color) {
4632N/A g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), (int)(color.getAlpha() * 0.25)));
4632N/A return currentContentBorderInsets;
4632N/A protected static void rotateInsets(final Insets topInsets, final Insets targetInsets, final int targetPlacement) {
4632N/A switch (targetPlacement) {
4632N/A return currentContentDrawingInsets;
4632N/A protected void paintContentBorder(final Graphics g, final int tabPlacement, final int selectedIndex) {
4632N/A switch (tabPlacement) {
4632N/A y += TAB_BORDER_INSET;
4632N/A h -= TAB_BORDER_INSET;
4632N/A switch (tabPlacement) {
4632N/A if (visibleTabState.getRightScrollTabRect().contains(p.x, p.y)) return -1; //tabPane.getTabCount();
4632N/A switch (tabPlacement) {
4632N/A protected int calculateTabHeight(final int tabPlacement, final int tabIndex, final int fontHeight) {
4632N/A return kLargeTabHeight;
4632N/A super.propertyChange(e);
4632N/A return new ChangeListener() {
4632N/A hasAvoidedFirstFocus = true;
4632N/A Component defaultFocusReceiver = KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy().getDefaultComponent(getTopLevelFocusCycleRootAncestor(component));
4632N/A isDefaultFocusReceiver = new Boolean(defaultFocusReceiver != null && defaultFocusReceiver.equals(component));
4632N/A if (trackingTab == -3 || (!shouldRepaintSelectedTabOnMouseDown() && trackingTab == pane.getSelectedIndex())) {
4632N/A showFullPopup(false);
4632N/A showFullPopup(true);
4632N/A if (visibleTabState.needsLeftScrollTab() && visibleTabState.getLeftScrollTabRect().contains(p)) return -2;
4632N/A if (visibleTabState.needsRightScrollTab() && visibleTabState.getRightScrollTabRect().contains(p)) return -1;
4632N/A popup.show(tabPane, rightScrollTabRect.x + rightScrollTabRect.width, rightScrollTabRect.y + 7);
4632N/A super.paintComponent(g);
4632N/A popupSelectionChanged = true;
4632N/A protected class AquaTruncatingTabbedPaneLayout extends AquaTabbedPaneCopyFromBasicUI.TabbedPaneLayout {
4632N/A // If they haven't been padded (which they only do when there are multiple rows) we should center them
4632N/A visibleTabState.alignRectsRunFor(rects, tabPane.getSize(), tabPlacement, AquaUtils.isLeftToRight(tabPane));
4632N/A protected void padTabRun(final int tabPlacement, final int start, final int end, final int max) {
4632N/A * 1. Calculate rects for the tabs - we have to play tricks here because our right and left tabs
4632N/A * should get widths calculated the same way as top and bottom, but they will be rotated so the
4632N/A * 3. When we cannot fit all the tabs we create a tab popup, and then layout the new tabs until
4632N/A * we can't fit them anymore. Laying them out is a matter of adding them into the visible list
4632N/A protected synchronized void superCalculateTabRects(final int tabPlacement, final int tabCount) {
4632N/A switch (tabPlacement) {
4632N/A final boolean verticalTabRuns = (tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT);
4632N/A if (verticalTabRuns) {
4632N/A visibleTabState.relayoutForScrolling(rects, x, y, returnAt, selectedIndex, verticalTabRuns, tabCount, AquaUtils.isLeftToRight(tabPane));
4632N/A private void calculateHorizontalTabRunRect(final Rectangle rect, final FontMetrics metrics, final int tabPlacement, final int returnAt, final int i, final int x, final int y) {
4632N/A private void calculateVerticalTabRunRect(final Rectangle rect, final FontMetrics metrics, final int tabPlacement, final int returnAt, final int i, final int x, final int y) {
4632N/A rect.x += insets.top + delta.x + getTabLabelShiftY(placement, i, isSeleceted) + (placement == SwingConstants.LEFT ? 2 : 1);