LabelWithHelpIcon.java revision 998747bfaaa3c6b28bbfaf0e282e6c0ccbf46bc0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A panel containing a label an a help icon. A customized tool tip is used,
* the tool tip is also displayed when the user clicks on the help icon.
*
*/
public class LabelWithHelpIcon extends JPanel
{
private static final long serialVersionUID = 4502977901538910797L;
/**
* The label with the text.
*/
/**
* The label with the icon.
*/
/**
* The left inset of the help icon.
*/
protected final int INSET_WITH_ICON= 3;
/**
* The constructor of this panel.
* @param text the text of the panel.
* @param tooltipIcon the tool tip of the help icon.
*/
{
super(new GridBagLayout());
setOpaque(false);
if (tooltipIcon != null)
{
}
}
/**
* Set the component this is labeling. Can be {@code null} if this does not
* label a {@code Component}.
* @param comp the {@code Component} to be labeled.
*/
{
}
/**
* Sets the text on the label.
* @param text the text to be displayed.
*/
{
}
/**
* Returns the text displayed on the panel.
* @return the text displayed on the panel.
*/
{
}
/**
* Sets the font to be used in this panel.
* @param font the font.
*/
{
// This is call by the constructor of JPanel.
{
}
}
/**
* Sets the tool tip to be used in the help icon.
* @param tooltip the tool tip text.
*/
{
}
/**
* Returns the tool tip to be used in the help icon.
* @return the tool tip to be used in the help icon.
*/
public String getHelpTooltip()
{
return iconLabel.getToolTipText();
}
/**
* Sets whether the help icon is visible or not.
* @param visible whether the help icon is visible or not.
*/
public void setHelpIconVisible(boolean visible)
{
if (visible)
{
{
}
}
{
}
}
/**
* Sets the foreground color for the text in this panel.
* @param color the foreground color for the text in this panel.
*/
{
super.setForeground(color);
{
// This is called in the constructor of the object.
}
}
/**
* {@inheritDoc}
*/
{
if (display)
{
return getHelpTooltip();
}
else
{
return null;
}
}
private void updateAccessibleContext()
{
if (s != null)
{
}
{
{
}
}
}
}