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 2014 ForgeRock AS. 016 */ 017 018package org.opends.guitools.controlpanel.ui.components; 019 020import javax.swing.JCheckBox; 021import javax.swing.SwingConstants; 022 023import org.opends.guitools.controlpanel.browser.IconPool; 024import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; 025import org.opends.guitools.controlpanel.util.Utilities; 026import org.forgerock.i18n.LocalizableMessage; 027 028/** 029 * A component that acts as a checkbox but uses some customized buttons to 030 * indicate the selected and unselected states. This component is used in the 031 * 'Import LDIF' and 'Export LDIF' panels to hide parts of the dialog. 032 * 033 */ 034public class BasicExpander extends JCheckBox 035{ 036 private static final long serialVersionUID = 2997408236059683190L; 037 038 /** 039 * Constructor of the BasicExpander. 040 * @param text the text to be displayed in the label of the BasicExpander. 041 */ 042 public BasicExpander(LocalizableMessage text) 043 { 044 super(text.toString()); 045 setHorizontalTextPosition(SwingConstants.TRAILING); 046 setHorizontalAlignment(SwingConstants.LEADING); 047 setFocusPainted(true); 048 setOpaque(false); 049 setSelectedIcon( 050 Utilities.createImageIcon(IconPool.IMAGE_PATH+"/downarrow.png")); 051 setIcon(Utilities.createImageIcon(IconPool.IMAGE_PATH+"/rightarrow.png")); 052 setFont(ColorAndFontConstants.expanderFont); 053 setForeground(ColorAndFontConstants.expanderForeground); 054 } 055}