src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2006, 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


  30 import java.awt.*;
  31 import java.awt.event.*;
  32 import javax.swing.plaf.*;
  33 import java.io.Serializable;
  34 import javax.swing.plaf.basic.BasicTabbedPaneUI;
  35 
  36 /**
  37  * The Metal subclass of BasicTabbedPaneUI.
  38  * <p>
  39  * <strong>Warning:</strong>
  40  * Serialized objects of this class will not be compatible with
  41  * future Swing releases. The current serialization support is
  42  * appropriate for short term storage or RMI between applications running
  43  * the same version of Swing.  As of 1.4, support for long term storage
  44  * of all JavaBeans&trade;
  45  * has been added to the <code>java.beans</code> package.
  46  * Please see {@link java.beans.XMLEncoder}.
  47  *
  48  * @author Tom Santos
  49  */
  50 
  51 public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
  52 
  53     protected int minTabWidth = 40;
  54     // Background color for unselected tabs that don't have an explicitly
  55     // set color.
  56     private Color unselectedBackground;
  57     protected Color tabAreaBackground;
  58     protected Color selectColor;
  59     protected Color selectHighlight;
  60     private boolean tabsOpaque = true;
  61 
  62     // Whether or not we're using ocean. This is cached as it is used
  63     // extensively during painting.
  64     private boolean ocean;
  65     // Selected border color for ocean.
  66     private Color oceanSelectedBorderColor;
  67 
  68     public static ComponentUI createUI( JComponent x ) {
  69         return new MetalTabbedPaneUI();
  70     }


   1 /*
   2  * Copyright (c) 1998, 2014, 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


  30 import java.awt.*;
  31 import java.awt.event.*;
  32 import javax.swing.plaf.*;
  33 import java.io.Serializable;
  34 import javax.swing.plaf.basic.BasicTabbedPaneUI;
  35 
  36 /**
  37  * The Metal subclass of BasicTabbedPaneUI.
  38  * <p>
  39  * <strong>Warning:</strong>
  40  * Serialized objects of this class will not be compatible with
  41  * future Swing releases. The current serialization support is
  42  * appropriate for short term storage or RMI between applications running
  43  * the same version of Swing.  As of 1.4, support for long term storage
  44  * of all JavaBeans&trade;
  45  * has been added to the <code>java.beans</code> package.
  46  * Please see {@link java.beans.XMLEncoder}.
  47  *
  48  * @author Tom Santos
  49  */
  50 @SuppressWarnings("serial") // Same-version serialization only
  51 public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
  52 
  53     protected int minTabWidth = 40;
  54     // Background color for unselected tabs that don't have an explicitly
  55     // set color.
  56     private Color unselectedBackground;
  57     protected Color tabAreaBackground;
  58     protected Color selectColor;
  59     protected Color selectHighlight;
  60     private boolean tabsOpaque = true;
  61 
  62     // Whether or not we're using ocean. This is cached as it is used
  63     // extensively during painting.
  64     private boolean ocean;
  65     // Selected border color for ocean.
  66     private Color oceanSelectedBorderColor;
  67 
  68     public static ComponentUI createUI( JComponent x ) {
  69         return new MetalTabbedPaneUI();
  70     }