src/share/classes/javax/swing/border/BevelBorder.java

Print this page


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


  27 import java.awt.Graphics;
  28 import java.awt.Insets;
  29 import java.awt.Color;
  30 import java.awt.Component;
  31 import java.beans.ConstructorProperties;
  32 
  33 /**
  34  * A class which implements a simple two-line bevel border.
  35  * <p>
  36  * <strong>Warning:</strong>
  37  * Serialized objects of this class will not be compatible with
  38  * future Swing releases. The current serialization support is
  39  * appropriate for short term storage or RMI between applications running
  40  * the same version of Swing.  As of 1.4, support for long term storage
  41  * of all JavaBeans&trade;
  42  * has been added to the <code>java.beans</code> package.
  43  * Please see {@link java.beans.XMLEncoder}.
  44  *
  45  * @author David Kloba
  46  */

  47 public class BevelBorder extends AbstractBorder
  48 {
  49     /** Raised bevel type. */
  50     public static final int RAISED  = 0;
  51     /** Lowered bevel type. */
  52     public static final int LOWERED = 1;
  53 
  54     protected int bevelType;
  55     protected Color highlightOuter;
  56     protected Color highlightInner;
  57     protected Color shadowInner;
  58     protected Color shadowOuter;
  59 
  60     /**
  61      * Creates a bevel border with the specified type and whose
  62      * colors will be derived from the background color of the
  63      * component passed into the paintBorder method.
  64      * @param bevelType the type of bevel for the border
  65      */
  66     public BevelBorder(int bevelType) {


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


  27 import java.awt.Graphics;
  28 import java.awt.Insets;
  29 import java.awt.Color;
  30 import java.awt.Component;
  31 import java.beans.ConstructorProperties;
  32 
  33 /**
  34  * A class which implements a simple two-line bevel border.
  35  * <p>
  36  * <strong>Warning:</strong>
  37  * Serialized objects of this class will not be compatible with
  38  * future Swing releases. The current serialization support is
  39  * appropriate for short term storage or RMI between applications running
  40  * the same version of Swing.  As of 1.4, support for long term storage
  41  * of all JavaBeans&trade;
  42  * has been added to the <code>java.beans</code> package.
  43  * Please see {@link java.beans.XMLEncoder}.
  44  *
  45  * @author David Kloba
  46  */
  47 @SuppressWarnings("serial") // Same-version serialization only
  48 public class BevelBorder extends AbstractBorder
  49 {
  50     /** Raised bevel type. */
  51     public static final int RAISED  = 0;
  52     /** Lowered bevel type. */
  53     public static final int LOWERED = 1;
  54 
  55     protected int bevelType;
  56     protected Color highlightOuter;
  57     protected Color highlightInner;
  58     protected Color shadowInner;
  59     protected Color shadowOuter;
  60 
  61     /**
  62      * Creates a bevel border with the specified type and whose
  63      * colors will be derived from the background color of the
  64      * component passed into the paintBorder method.
  65      * @param bevelType the type of bevel for the border
  66      */
  67     public BevelBorder(int bevelType) {