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