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 specific to the accordion element. */ 029public class AccordionElementBorder implements Border 030{ 031 private Insets insets = new Insets(1, 1, 1, 1); 032 033 /** Default constructor. */ 034 public AccordionElementBorder() { 035 } 036 037 @Override 038 public Insets getBorderInsets(Component c) { 039 return insets; 040 } 041 042 @Override 043 public boolean isBorderOpaque() { 044 return true; 045 } 046 047 @Override 048 public void paintBorder(Component c, Graphics g, int x, int y, int width, 049 int height) { 050 g.setColor(ColorAndFontConstants.topAccordionBorderColor); 051 // render highlight at top 052 g.drawLine(x, y, x + width - 1, y); 053 // render left 054 g.drawLine(x, y, x, y + height - 1); 055 // render right 056 g.drawLine(x + width - 1, y, x + width - 1, y + height - 1); 057 // render shadow on bottom 058 g.setColor(ColorAndFontConstants.defaultBorderColor); 059 g.drawLine(x, y + height - 1, x + width - 1, y + height - 1); 060 } 061}