4632N/A return new AquaTabbedPaneCopyFromBasicUI();
4632N/A calculatedBaseline = false;
4632N/A return new TabbedPaneScrollLayout();
4632N/A return new TabbedPaneLayout();
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A throw new IllegalArgumentException("Direction must be one of: " + "SOUTH, NORTH, EAST or WEST");
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background", "TabbedPane.foreground", "TabbedPane.font");
4632N/A return getHandler();
4632N/A return getHandler();
4632N/A return getHandler();
4632N/A return getHandler();
4632N/A SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, km);
4632N/A LazyActionMap.installLazyActionMap(tabPane, AquaTabbedPaneCopyFromBasicUI.class, "TabbedPane.actionMap");
4632N/A SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
4632N/A // [2165820] Mac OS X change: mnemonics need to be triggered with ctrl-option, not just option.
4632N/A mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK | Event.CTRL_MASK), "setSelectedIndex");
4632N/A mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane, JComponent.WHEN_IN_FOCUSED_WINDOW));
4632N/A SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_IN_FOCUSED_WINDOW, mnemonicInputMap);
4632N/A return rolloverTabIndex;
4632N/A super.getBaselineResizeBehavior(c);
4632N/A return c.getBaseline(pref.width, pref.height) + (cellHeight - pref.height) / 2 + tabInsets.top;
4632N/A final int baseline = BasicHTML.getHTMLBaseline(view, (int)view.getPreferredSpan(View.X_AXIS), viewHeight);
4632N/A if (!calculatedBaseline) {
4632N/A calculatedBaseline = true;
4632N/A if (isHorizontalTabPlacement()) {
4632N/A if (tabsOverlapBorder) {
4632N/A if (!tabsOverlapBorder) {
4632N/A protected void paintTabArea(final Graphics g, final int tabPlacement, final int selectedIndex) {
4632N/A protected void paintTab(final Graphics g, final int tabPlacement, final Rectangle[] rects, final int tabIndex, final Rectangle iconRect, final Rectangle textRect) {
4632N/A paintTabBackground(g, tabPlacement, tabIndex, tabRect.x, tabRect.y, tabRect.width, tabRect.height, isSelected);
4632N/A paintTabBorder(g, tabPlacement, tabIndex, tabRect.x, tabRect.y, tabRect.width, tabRect.height, isSelected);
4632N/A layoutLabel(tabPlacement, metrics, tabIndex, title, icon, tabRect, iconRect, textRect, isSelected);
4632N/A if (scrollableTabLayoutEnabled() && tabScroller.croppedEdge.isParamsSet() && tabScroller.croppedEdge.getTabIndex() == tabIndex && isHorizontalTabPlacement()) {
4632N/A final int availTextWidth = tabScroller.croppedEdge.getCropline() - (textRect.x - tabRect.x) - tabScroller.croppedEdge.getCroppedSideWidth();
4632N/A private static Polygon createCroppedTabShape(final int tabPlacement, final Rectangle tabRect, final int cropline) {
4632N/A switch (tabPlacement) {
4632N/A g.drawLine(xx + yCropLen[i], y - xCropLen[i], xx + yCropLen[i + 1] - 1, y - xCropLen[i + 1]);
4632N/A g.drawLine(x - xCropLen[i], yy + yCropLen[i], x - xCropLen[i + 1], yy + yCropLen[i + 1] - 1);
4632N/A protected void layoutLabel(final int tabPlacement, final FontMetrics metrics, final int tabIndex, final String title, final Icon icon, final Rectangle tabRect, final Rectangle iconRect, final Rectangle textRect, final boolean isSelected) {
4632N/A SwingUtilities.layoutCompoundLabel(tabPane, metrics, title, icon, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.TRAILING, tabRect, iconRect, textRect, textIconGap);
4632N/A protected void paintIcon(final Graphics g, final int tabPlacement, final int tabIndex, final Icon icon, final Rectangle iconRect, final boolean isSelected) {
4632N/A protected void paintText(final Graphics g, final int tabPlacement, final Font font, final FontMetrics metrics, final int tabIndex, final String title, final Rectangle textRect, final boolean isSelected) {
4632N/A SwingUtilities2.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
4632N/A SwingUtilities2.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent());
4632N/A SwingUtilities2.drawStringUnderlineCharAt(tabPane, g, title, mnemIndex, textRect.x - 1, textRect.y + metrics.getAscent() - 1);
4632N/A protected int getTabLabelShiftX(final int tabPlacement, final int tabIndex, final boolean isSelected) {
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 void paintFocusIndicator(final Graphics g, final int tabPlacement, final Rectangle[] rects, final int tabIndex, final Rectangle iconRect, final Rectangle textRect, final boolean isSelected) {
4632N/A switch (tabPlacement) {
4632N/A protected void paintTabBorder(final Graphics g, final int tabPlacement, final int tabIndex, final int x, final int y, final int w, final int h, final boolean isSelected) {
4632N/A switch (tabPlacement) {
4632N/A protected void paintTabBackground(final Graphics g, final int tabPlacement, final int tabIndex, final int x, final int y, final int w, final int h, boolean isSelected) {
4632N/A g.setColor(!isSelected || selectedColor == null ? tabPane.getBackgroundAt(tabIndex) : selectedColor);
4632N/A switch (tabPlacement) {
4632N/A protected void paintContentBorder(final Graphics g, final int tabPlacement, final int selectedIndex) {
4632N/A switch (tabPlacement) {
4632N/A if (tabsOverlapBorder) {
4632N/A if (tabsOverlapBorder) {
4632N/A if (tabsOverlapBorder) {
4632N/A if (tabsOverlapBorder) {
4632N/A protected void paintContentBorderTopEdge(final Graphics g, final int tabPlacement, final int selectedIndex, final int x, final int y, final int w, final int h) {
4632N/A if (tabPlacement != TOP || selectedIndex < 0 || (selRect.y + selRect.height + 1 < y) || (selRect.x < x || selRect.x > x + w)) {
4632N/A protected void paintContentBorderLeftEdge(final Graphics g, final int tabPlacement, final int selectedIndex, final int x, final int y, final int w, final int h) {
4632N/A if (tabPlacement != LEFT || selectedIndex < 0 || (selRect.x + selRect.width + 1 < x) || (selRect.y < y || selRect.y > y + h)) {
4632N/A protected void paintContentBorderBottomEdge(final Graphics g, final int tabPlacement, final int selectedIndex, final int x, final int y, final int w, final int h) {
4632N/A if (tabPlacement != BOTTOM || selectedIndex < 0 || (selRect.y - 1 > h) || (selRect.x < x || selRect.x > x + w)) {
4632N/A protected void paintContentBorderRightEdge(final Graphics g, final int tabPlacement, final int selectedIndex, final int x, final int y, final int w, final int h) {
4632N/A if (tabPlacement != RIGHT || selectedIndex < 0 || (selRect.x - 1 > w) || (selRect.y < y || selRect.y > y + h)) {
4632N/A private int tabForCoordinate(final JTabbedPane pane, final int x, final int y, final boolean validateIfNecessary) {
4632N/A if (validateIfNecessary) {
4632N/A if (isRunsDirty) {
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A translatePointToTabPanel(x, y, p);
4632N/A return visibleComponent;
4632N/A if (visibleComponent != null && visibleComponent != component && visibleComponent.getParent() == tabPane && visibleComponent.isVisible()) {
4632N/A return tabRunOverlay;
4632N/A return (!tabPane.isEnabled() || !tabPane.isEnabledAt(tabIndex)) ? tabPane.getDisabledIconAt(tabIndex) : tabPane.getIconAt(tabIndex);
4632N/A protected int calculateTabHeight(final int tabPlacement, final int tabIndex, final int fontHeight) {
4632N/A protected int calculateTabWidth(final int tabPlacement, final int tabIndex, final FontMetrics metrics) {
4632N/A protected int calculateTabAreaHeight(final int tabPlacement, final int horizRunCount, final int maxTabHeight) {
4632N/A return (horizRunCount > 0 ? horizRunCount * (maxTabHeight - tabRunOverlay) + tabRunOverlay + tabAreaInsets.top + tabAreaInsets.bottom : 0);
4632N/A protected int calculateTabAreaWidth(final int tabPlacement, final int vertRunCount, final int maxTabWidth) {
4632N/A return (vertRunCount > 0 ? vertRunCount * (maxTabWidth - tabRunOverlay) + tabRunOverlay + tabAreaInsets.left + tabAreaInsets.right : 0);
4632N/A return currentPadInsets;
4632N/A return currentTabAreaInsets;
4632N/A return contentBorderInsets;
4632N/A final int current = DefaultLookup.getBoolean(tabPane, this, "TabbedPane.selectionFollowsFocus", true) ? tabPane.getSelectedIndex() : getFocusIndex();
4632N/A switch (tabPlacement) {
4632N/A if (leftToRight) {
4632N/A if (leftToRight) {
4632N/A protected void selectAdjacentRunTab(final int tabPlacement, final int tabIndex, final int offset) {
4632N/A switch (tabPlacement) {
4632N/A return focusIndex;
4632N/A protected int getTabRunOffset(final int tabPlacement, final int tabCount, final int tabIndex, final boolean forward) {
4632N/A switch (tabPlacement) {
4632N/A offset = (forward ? -(calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth) - maxTabWidth) : -maxTabWidth);
4632N/A offset = (forward ? maxTabWidth : calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth) - maxTabWidth);
4632N/A offset = (forward ? maxTabWidth : calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth) - maxTabWidth);
4632N/A offset = (forward ? -(calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth) - maxTabWidth) : -maxTabWidth);
4632N/A offset = (forward ? maxTabHeight : calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) - maxTabHeight);
4632N/A offset = (forward ? -(calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) - maxTabHeight) : -maxTabHeight);
4632N/A offset = (forward ? -(calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) - maxTabHeight) : -maxTabHeight);
4632N/A offset = (forward ? maxTabHeight : calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) - maxTabHeight);
4632N/A protected static void rotateInsets(final Insets topInsets, final Insets targetInsets, final int targetPlacement) {
4632N/A switch (targetPlacement) {
4632N/A static Object getUIOfType(final ComponentUI ui, final Class<AquaTabbedPaneCopyFromBasicUI> klass) {
4632N/A final AquaTabbedPaneCopyFromBasicUI ui = (AquaTabbedPaneCopyFromBasicUI)getUIOfType(pane.getUI(), AquaTabbedPaneCopyFromBasicUI.class);
4632N/A return tabContainer;
4632N/A return calculateSize(false);
4632N/A return calculateSize(true);
4632N/A switch (tabPlacement) {
4632N/A tabExtent = preferredTabAreaWidth(tabPlacement, height - tabAreaInsets.top - tabAreaInsets.bottom);
4632N/A tabExtent = preferredTabAreaHeight(tabPlacement, width - tabAreaInsets.left - tabAreaInsets.right);
4632N/A return new Dimension(width + insets.left + insets.right + contentInsets.left + contentInsets.right, height + insets.bottom + insets.top + contentInsets.top + contentInsets.bottom);
4632N/A boolean shouldChangeFocus = false;
4632N/A shouldChangeFocus = true;
4632N/A switch (tabPlacement) {
4632N/A cw = bounds.width - totalTabWidth - insets.left - insets.right - contentInsets.left - contentInsets.right;
4632N/A ch = bounds.height - totalTabHeight - insets.top - insets.bottom - contentInsets.top - contentInsets.bottom;
4632N/A final int tabContainerWidth = totalTabWidth == 0 ? bounds.width : totalTabWidth + insets.left + insets.right + contentInsets.left + contentInsets.right;
4632N/A final int tabContainerHeight = totalTabHeight == 0 ? bounds.height : totalTabHeight + insets.top + insets.bottom + contentInsets.top + contentInsets.bottom;
4632N/A if (shouldChangeFocus) {
4632N/A if (!requestFocusForVisibleComponent()) {
4632N/A isRunsDirty = false;
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A c.setBounds(x + getTabLabelShiftX(tabPlacement, i, isSeleceted), y + getTabLabelShiftY(tabPlacement, i, isSeleceted), preferredSize.width, preferredSize.height);
4632N/A int tabRunOverlay;
4632N/A switch (tabPlacement) {
4632N/A if (!verticalTabRuns) {
4632N/A if (i == selectedIndex) {
4632N/A if (!verticalTabRuns) {
4632N/A protected void normalizeTabRuns(final int tabPlacement, final int tabCount, final int start, final int max) {
4632N/A boolean keepAdjusting = true;
4632N/A while (keepAdjusting) {
4632N/A int prevLastLen;
4632N/A if (!verticalTabRuns) {
4632N/A if (!verticalTabRuns) {
4632N/A if (!verticalTabRuns) {
4632N/A keepAdjusting = false;
4632N/A protected void padTabRun(final int tabPlacement, final int start, final int end, final int max) {
4632N/A boolean shouldChangeFocus = false;
4632N/A shouldChangeFocus = true;
4632N/A switch (tabPlacement) {
4632N/A cw = bounds.width - insets.left - insets.right - tw - contentInsets.left - contentInsets.right;
4632N/A cw = bounds.width - insets.left - insets.right - tw - contentInsets.left - contentInsets.right;
4632N/A ch = bounds.height - insets.top - insets.bottom - th - contentInsets.top - contentInsets.bottom;
4632N/A ch = bounds.height - insets.top - insets.bottom - th - contentInsets.top - contentInsets.bottom;
4632N/A switch (tabPlacement) {
4632N/A } else if (tabScroller != null && (child == tabScroller.scrollForwardButton || child == tabScroller.scrollBackwardButton)) {
4632N/A switch (tabPlacement) {
4632N/A by = (child == tabScroller.scrollForwardButton) ? bounds.height - insets.bottom - bsize.height : bounds.height - insets.bottom - 2 * bsize.height;
4632N/A bx = (child == tabScroller.scrollForwardButton) ? bounds.width - insets.left - bsize.width : bounds.width - insets.left - 2 * bsize.width;
4632N/A super.layoutTabComponents();
4632N/A if (shouldChangeFocus) {
4632N/A if (!requestFocusForVisibleComponent()) {
4632N/A tabScroller.croppedEdge.setParams(i, cropline - tabRect.y - 1, -currentTabAreaInsets.left, 0);
4632N/A tabScroller.croppedEdge.setParams(i, cropline - tabRect.x - 1, 0, -currentTabAreaInsets.top);
4632N/A switch (tabPlacement) {
4632N/A if (!verticalTabRuns) {
4632N/A if (tabsOverlapBorder) {
4632N/A switch (tabPlacement) {
4632N/A final Dimension extentSize = new Dimension(viewSize.width - tabViewPosition.x, viewRect.height);
4632N/A final Dimension extentSize = new Dimension(viewRect.width, viewSize.height - tabViewPosition.y);
4632N/A switch (tabPlacement) {
4632N/A switch (tabPlacement) {
4632N/A scrollForwardButton.setEnabled(leadingTabIndex < tabCount - 1 && viewSize.height - viewRect.y > viewRect.height);
4632N/A tabPane.repaint(vpRect.x - contentInsets.right, vpRect.y, contentInsets.right, vpRect.height);
4632N/A scrollForwardButton.setEnabled(leadingTabIndex < tabCount - 1 && viewSize.height - viewRect.y > viewRect.height);
4632N/A tabPane.repaint(vpRect.x, vpRect.y - contentInsets.bottom, vpRect.width, contentInsets.bottom);
4632N/A scrollForwardButton.setEnabled(leadingTabIndex < tabCount - 1 && viewSize.width - viewRect.x > viewRect.width);
4632N/A scrollForwardButton.setEnabled(leadingTabIndex < tabCount - 1 && viewSize.width - viewRect.x > viewRect.width);
4632N/A action.actionPerformed(new ActionEvent(tabPane, ActionEvent.ACTION_PERFORMED, null, e.getWhen(), e.getModifiers()));
4632N/A return new String("viewport.viewSize=" + viewport.getViewSize() + "\n" + "viewport.viewRectangle=" + viewport.getViewRect() + "\n" + "leadingTabIndex=" + leadingTabIndex + "\n" + "tabViewPosition=" + tabViewPosition);
4632N/A super.paintComponent(g);
4632N/A AquaTabbedPaneCopyFromBasicUI.this.paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
4632N/A private class ScrollableTabButton extends javax.swing.plaf.basic.BasicArrowButton implements UIResource, SwingConstants {
4632N/A super(direction, UIManager.getColor("TabbedPane.selected"), UIManager.getColor("TabbedPane.shadow"), UIManager.getColor("TabbedPane.darkShadow"), UIManager.getColor("TabbedPane.highlight"));
4632N/A private class Handler implements ChangeListener, ContainerListener, FocusListener, MouseListener, MouseMotionListener, PropertyChangeListener {
4632N/A calculatedBaseline = false;
4632N/A calculatedBaseline = false;
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A calculatedBaseline = false;
4632N/A calculatedBaseline = false;
4639N/A isRunsDirty = true;
4632N/A calculatedBaseline = false;
4632N/A if (scrollableTabLayoutEnabled()) {
4639N/A isRunsDirty = true;
4632N/A isRunsDirty = true;
4632N/A if (!(c instanceof UIResource)) {
4632N/A if (scrollableTabLayoutEnabled()) {
4632N/A public void setParams(final int tabIndex, final int cropline, final int cropx, final int cropy) {
4632N/A super.paintComponent(g);
4632N/A static void installLazyActionMap(final JComponent c, final Class<AquaTabbedPaneCopyFromBasicUI> loaderClass, final String defaultsKey) {
4632N/A static ActionMap getActionMap(final Class<AquaTabbedPaneCopyFromBasicUI> loaderClass, final String defaultsKey) {