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-2016 ForgeRock AS. 016 */ 017 018package org.opends.guitools.controlpanel.ui; 019 020import static org.opends.messages.AdminToolMessages.*; 021 022import java.awt.GridBagConstraints; 023import java.awt.GridBagLayout; 024 025import javax.swing.JLabel; 026import javax.swing.JPanel; 027 028import org.opends.guitools.controlpanel.util.Utilities; 029import org.forgerock.i18n.LocalizableMessage; 030 031/** A simple panel containing a message. */ 032public class NoItemSelectedPanel extends JPanel 033{ 034 private JLabel l; 035 private LocalizableMessage msg; 036 private static final long serialVersionUID = -8288525745479095426L; 037 038 /** Default constructor. */ 039 public NoItemSelectedPanel() 040 { 041 super(new GridBagLayout()); 042 setOpaque(false); 043 GridBagConstraints gbc = new GridBagConstraints(); 044 msg = INFO_CTRL_PANEL_NO_ITEM_SELECTED_LABEL.get(); 045 l = Utilities.createPrimaryLabel(msg); 046 add(l, gbc); 047 } 048 049 /** 050 * Sets the message to be displayed. 051 * @param text the message to be displayed. 052 */ 053 public void setMessage(LocalizableMessage text) 054 { 055 msg = text; 056 l.setText(text.toString()); 057 } 058 059 /** 060 * Returns the displayed message. 061 * @return the displayed message. 062 */ 063 public LocalizableMessage getMessage() 064 { 065 return msg; 066 } 067}