< prev index next >

src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 313             transposeRect(fContentRect);
 314             transposeRect(iconRect);
 315             transposeRect(textRect);
 316         }
 317 
 318         // from super.paintText - its normal text painting is totally wrong for the Mac
 319         if (!(g instanceof Graphics2D)) {
 320             g.setClip(temp);
 321             return;
 322         }
 323         final Graphics2D g2d = (Graphics2D) g;
 324 
 325         AffineTransform savedAT = null;
 326         if (isVertical) {
 327             savedAT = g2d.getTransform();
 328             rotateGraphics(g2d, tabRect, textRect, iconRect, tabPlacement);
 329         }
 330 
 331         // not for the scrolling tabs
 332         if (component == null && tabIndex >= 0) {
 333             paintTitle(g2d, font, metrics, textRect, tabIndex, title);


 334         }
 335 
 336         if (icon != null) {
 337             paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
 338         }
 339 
 340         if (savedAT != null) {
 341             g2d.setTransform(savedAT);
 342         }
 343 
 344         g.setClip(temp);
 345     }
 346 
 347     protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
 348         final View v = getTextViewForTab(tabIndex);
 349         if (v != null) {
 350             v.paint(g2d, textRect);
 351             return;
 352         }
 353 


   1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 313             transposeRect(fContentRect);
 314             transposeRect(iconRect);
 315             transposeRect(textRect);
 316         }
 317 
 318         // from super.paintText - its normal text painting is totally wrong for the Mac
 319         if (!(g instanceof Graphics2D)) {
 320             g.setClip(temp);
 321             return;
 322         }
 323         final Graphics2D g2d = (Graphics2D) g;
 324 
 325         AffineTransform savedAT = null;
 326         if (isVertical) {
 327             savedAT = g2d.getTransform();
 328             rotateGraphics(g2d, tabRect, textRect, iconRect, tabPlacement);
 329         }
 330 
 331         // not for the scrolling tabs
 332         if (component == null && tabIndex >= 0) {
 333             String clippedTitle = SwingUtilities2.clipStringIfNecessary(null, metrics,
 334                     title, textRect.width);
 335             paintTitle(g2d, font, metrics, textRect, tabIndex, clippedTitle);
 336         }
 337 
 338         if (icon != null) {
 339             paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
 340         }
 341 
 342         if (savedAT != null) {
 343             g2d.setTransform(savedAT);
 344         }
 345 
 346         g.setClip(temp);
 347     }
 348 
 349     protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
 350         final View v = getTextViewForTab(tabIndex);
 351         if (v != null) {
 352             v.paint(g2d, textRect);
 353             return;
 354         }
 355 


< prev index next >