001    package com.softnetConsult.utils.swing;
002    
003    import java.awt.Component;
004    import java.awt.LayoutManager;
005    
006    import javax.swing.JPanel;
007    
008    /**
009     * A {@code JPanel} which forwards its {@code enabled} state to all its child components.
010     * 
011     * <p style="font-size:smaller;">This product includes software developed by the
012     *    <strong>SoftNet-Consult Java Utility Library</strong> project and its contributors.<br />
013     *    (<a href="http://java-tools.sourceforge.net" target="_blank">http://java-tools.sourceforge.net</a>)<br />
014     *    Copyright (c) 2007-2008 SoftNet-Consult.<br />
015     *    Copyright (c) 2007-2008 G. Paperin.<br />
016     *    All rights reserved.
017     * </p>
018     * <p style="font-size:smaller;">File: DisEnablingPanel.java<br />
019     *    Library API version: {@value com.softnetConsult.utils.APIProperties#apiVersion}<br />
020     *    Java compliance version: {@value com.softnetConsult.utils.APIProperties#javaComplianceVersion}
021     * </p>
022     * <p style="font-size:smaller;">Redistribution and use in source and binary forms, with or
023     *    without modification, are permitted provided that the following terms and conditions are met:
024     * </p>
025     * <p style="font-size:smaller;">1. Redistributions of source code must retain the above
026     *    acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright
027     *    notice, this list of conditions and the following disclaimer.<br />
028     *    2. Redistributions in binary form must reproduce the above acknowledgement of the
029     *    SoftNet-Consult Java Utility Library project, the above copyright notice, this list of
030     *    conditions and the following disclaimer in the documentation and/or other materials
031     *    provided with the distribution.<br />
032     *    3. All advertising materials mentioning features or use of this software or any derived
033     *    software must display the following acknowledgement:<br />
034     *    <em>This product includes software developed by the SoftNet-Consult Java Utility Library
035     *    project and its contributors.</em>
036     * </p>
037     * <p style="font-size:smaller;">THIS SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY
038     *    OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
039     *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  NONINFRINGEMENT. IN NO EVENT SHALL
040     *    THE AUTHORS, CONTRIBUTORS OR COPYRIGHT  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
041     *    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  FROM, OUT OF OR
042     *    IN CONNECTION WITH THE SOFTWARE OR THE USE OR  OTHER DEALINGS IN THE SOFTWARE.
043     * </p> 
044     * @author Greg Paperin (<a href="http://www.paperin.org" target="_blank">http://www.paperin.org</a>)
045     * @version {@value com.softnetConsult.utils.APIProperties#apiVersion}
046     *
047     */
048    public class DisEnablingPanel extends JPanel {
049    
050    public DisEnablingPanel()                                                                                               { super(); }
051    public DisEnablingPanel(boolean isDoubleBuffered)                                               { super(isDoubleBuffered); }
052    public DisEnablingPanel(LayoutManager layout)                                                   { super(layout); }
053    public DisEnablingPanel(LayoutManager layout, boolean isDoubleBuffered) { super(layout, isDoubleBuffered); }
054    
055    @Override
056    public void setEnabled(boolean enabled) {
057            
058            super.setEnabled(enabled);
059            
060            for (Component child : this.getComponents()) {
061                    child.setEnabled(enabled);
062            }
063    }
064    
065    } // public class DisEnablingPanel