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