0N/A/*
2362N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.swing.plaf;
0N/A
0N/Aimport java.awt.Component;
0N/Aimport java.awt.Insets;
0N/Aimport java.awt.Color;
0N/Aimport java.awt.Font;
0N/Aimport java.awt.Graphics;
0N/Aimport java.io.Serializable;
0N/A
0N/Aimport java.beans.ConstructorProperties;
0N/Aimport javax.swing.border.*;
0N/Aimport javax.swing.Icon;
0N/Aimport javax.swing.plaf.UIResource;
0N/A
0N/A
0N/A/*
0N/A * A Border wrapper class which implements UIResource. UI
0N/A * classes which set border properties should use this class
0N/A * to wrap any borders specified as defaults.
0N/A *
0N/A * This class delegates all method invocations to the
0N/A * Border "delegate" object specified at construction.
0N/A * <p>
0N/A * <strong>Warning:</strong>
0N/A * Serialized objects of this class will not be compatible with
0N/A * future Swing releases. The current serialization support is
0N/A * appropriate for short term storage or RMI between applications running
0N/A * the same version of Swing. As of 1.4, support for long term storage
0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup>
0N/A * has been added to the <code>java.beans</code> package.
0N/A * Please see {@link java.beans.XMLEncoder}.
0N/A *
0N/A * @see javax.swing.plaf.UIResource
0N/A * @author Amy Fowler
0N/A *
0N/A */
0N/Apublic class BorderUIResource implements Border, UIResource, Serializable
0N/A{
0N/A static Border etched;
0N/A static Border loweredBevel;
0N/A static Border raisedBevel;
0N/A static Border blackLine;
0N/A
0N/A public static Border getEtchedBorderUIResource() {
0N/A if (etched == null) {
0N/A etched = new EtchedBorderUIResource();
0N/A }
0N/A return etched;
0N/A }
0N/A
0N/A public static Border getLoweredBevelBorderUIResource() {
0N/A if (loweredBevel == null) {
0N/A loweredBevel = new BevelBorderUIResource(BevelBorder.LOWERED);
0N/A }
0N/A return loweredBevel;
0N/A }
0N/A
0N/A public static Border getRaisedBevelBorderUIResource() {
0N/A if (raisedBevel == null) {
0N/A raisedBevel = new BevelBorderUIResource(BevelBorder.RAISED);
0N/A }
0N/A return raisedBevel;
0N/A }
0N/A
0N/A public static Border getBlackLineBorderUIResource() {
0N/A if (blackLine == null) {
0N/A blackLine = new LineBorderUIResource(Color.black);
0N/A }
0N/A return blackLine;
0N/A }
0N/A
0N/A private Border delegate;
0N/A
0N/A /**
0N/A * Creates a UIResource border object which wraps
0N/A * an existing Border instance.
0N/A * @param delegate the border being wrapped
0N/A */
0N/A public BorderUIResource(Border delegate) {
0N/A if (delegate == null) {
0N/A throw new IllegalArgumentException("null border delegate argument");
0N/A }
0N/A this.delegate = delegate;
0N/A }
0N/A
0N/A public void paintBorder(Component c, Graphics g, int x, int y,
0N/A int width, int height) {
0N/A delegate.paintBorder(c, g, x, y, width, height);
0N/A }
0N/A
0N/A public Insets getBorderInsets(Component c) {
0N/A return delegate.getBorderInsets(c);
0N/A }
0N/A
0N/A public boolean isBorderOpaque() {
0N/A return delegate.isBorderOpaque();
0N/A }
0N/A
0N/A public static class CompoundBorderUIResource extends CompoundBorder implements UIResource {
0N/A @ConstructorProperties({"outsideBorder", "insideBorder"})
0N/A public CompoundBorderUIResource(Border outsideBorder, Border insideBorder) {
0N/A super(outsideBorder, insideBorder);
0N/A }
0N/A
0N/A }
0N/A
0N/A public static class EmptyBorderUIResource extends EmptyBorder implements UIResource {
0N/A
0N/A public EmptyBorderUIResource(int top, int left, int bottom, int right) {
0N/A super(top, left, bottom, right);
0N/A }
0N/A @ConstructorProperties({"borderInsets"})
0N/A public EmptyBorderUIResource(Insets insets) {
0N/A super(insets);
0N/A }
0N/A }
0N/A
0N/A public static class LineBorderUIResource extends LineBorder implements UIResource {
0N/A
0N/A public LineBorderUIResource(Color color) {
0N/A super(color);
0N/A }
0N/A
0N/A @ConstructorProperties({"lineColor", "thickness"})
0N/A public LineBorderUIResource(Color color, int thickness) {
0N/A super(color, thickness);
0N/A }
0N/A }
0N/A
0N/A
0N/A public static class BevelBorderUIResource extends BevelBorder implements UIResource {
0N/A
0N/A public BevelBorderUIResource(int bevelType) {
0N/A super(bevelType);
0N/A }
0N/A
0N/A public BevelBorderUIResource(int bevelType, Color highlight, Color shadow) {
0N/A super(bevelType, highlight, shadow);
0N/A }
0N/A
0N/A @ConstructorProperties({"bevelType", "highlightOuterColor", "highlightInnerColor", "shadowOuterColor", "shadowInnerColor"})
0N/A public BevelBorderUIResource(int bevelType,
0N/A Color highlightOuter, Color highlightInner,
0N/A Color shadowOuter, Color shadowInner) {
0N/A super(bevelType, highlightOuter, highlightInner, shadowOuter, shadowInner);
0N/A }
0N/A }
0N/A
0N/A public static class EtchedBorderUIResource extends EtchedBorder implements UIResource {
0N/A
0N/A public EtchedBorderUIResource() {
0N/A super();
0N/A }
0N/A
0N/A public EtchedBorderUIResource(int etchType) {
0N/A super(etchType);
0N/A }
0N/A
0N/A public EtchedBorderUIResource(Color highlight, Color shadow) {
0N/A super(highlight, shadow);
0N/A }
0N/A
0N/A @ConstructorProperties({"etchType", "highlightColor", "shadowColor"})
0N/A public EtchedBorderUIResource(int etchType, Color highlight, Color shadow) {
0N/A super(etchType, highlight, shadow);
0N/A }
0N/A }
0N/A
0N/A public static class MatteBorderUIResource extends MatteBorder implements UIResource {
0N/A
0N/A public MatteBorderUIResource(int top, int left, int bottom, int right,
0N/A Color color) {
0N/A super(top, left, bottom, right, color);
0N/A }
0N/A
0N/A public MatteBorderUIResource(int top, int left, int bottom, int right,
0N/A Icon tileIcon) {
0N/A super(top, left, bottom, right, tileIcon);
0N/A }
0N/A
0N/A public MatteBorderUIResource(Icon tileIcon) {
0N/A super(tileIcon);
0N/A }
0N/A }
0N/A
0N/A public static class TitledBorderUIResource extends TitledBorder implements UIResource {
0N/A
0N/A public TitledBorderUIResource(String title) {
0N/A super(title);
0N/A }
0N/A
0N/A public TitledBorderUIResource(Border border) {
0N/A super(border);
0N/A }
0N/A
0N/A public TitledBorderUIResource(Border border, String title) {
0N/A super(border, title);
0N/A }
0N/A
0N/A public TitledBorderUIResource(Border border,
0N/A String title,
0N/A int titleJustification,
0N/A int titlePosition) {
0N/A super(border, title, titleJustification, titlePosition);
0N/A }
0N/A
0N/A public TitledBorderUIResource(Border border,
0N/A String title,
0N/A int titleJustification,
0N/A int titlePosition,
0N/A Font titleFont) {
0N/A super(border, title, titleJustification, titlePosition, titleFont);
0N/A }
0N/A
0N/A @ConstructorProperties({"border", "title", "titleJustification", "titlePosition", "titleFont", "titleColor"})
0N/A public TitledBorderUIResource(Border border,
0N/A String title,
0N/A int titleJustification,
0N/A int titlePosition,
0N/A Font titleFont,
0N/A Color titleColor) {
0N/A super(border, title, titleJustification, titlePosition, titleFont, titleColor);
0N/A }
0N/A }
0N/A
0N/A}