001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2015 ForgeRock AS.
026 */
027
028package org.opends.guitools.controlpanel.ui.border;
029
030import java.awt.Component;
031import java.awt.Graphics;
032import java.awt.Insets;
033
034import javax.swing.border.Border;
035
036import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
037
038/** The border of the CategoryButton when is selected. */
039public class SelectedCategoryBorder implements Border
040{
041  private Insets insets = new Insets(5, 5, 6, 5);
042
043  /** Default constructor. */
044  public SelectedCategoryBorder() {
045  }
046
047  /** {@inheritDoc} */
048  public Insets getBorderInsets(Component c)
049  {
050    return insets;
051  }
052
053  /** {@inheritDoc} */
054  public boolean isBorderOpaque()
055  {
056    return true;
057  }
058
059  /** {@inheritDoc} */
060  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
061  {
062    // render shadow on bottom
063    g.setColor(ColorAndFontConstants.defaultBorderColor);
064    g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
065  }
066}